I am trying to inject javax.mail.session in ejb 3.1 via @Resource without any success, I believe that I miss understood the proper configurations (I want annotations based solution and not XML descriptor)
Actually, using @Resource
for JavaMail is not something new in EJB 3.1, it was already possible with Java EE 5 and is covered in the The confirmer Example Application of the Java EE 5 Tutorial, including the application server configuration part (yes, this part is application server specific).
For GlassFish v3 (you didn't mention it but I'm assuming you're using GFv3), see:
Thanks! But there is no mention about the solution of JEE 6 Connector API with annotations configuration (smtp host + username + password + protocol and etc)...? Did you know on that topic? Thanks!
Honestly, I'm not sure to understand what you're trying to do exactly. You're talking about using JCA to send emails via a MDB, using annotations. This is confusing, at least for me. You should maybe include some links pointing to the things you saw, include some context information.
That being said, if your question is actually how to write a custom JCA mail resource adapter, maybe the following article will help: