How do you use the JNDI ENC to access JavaMail?
Created May 4, 2012
Steven Lau First of all, you have to create a javax.mail.Session like you would in accessing other resources such as JDBC connections:
InitialContext ctx = new InitialContext(); Session session = (Session) ctx.lookup("java:comp/env/TheMailSession");After that, everything else is the same:
Message msg = new MimeMessage(session); ... ...Depending on the application server you're using, you'll have different ways in setting up the ENC.