How do you use the JNDI ENC to access JavaMail?
Location: http://www.jguru.com/faq/view.jsp?EID=75066 Created: Jun 14, 2000 Modified: 2000-06-14 07:30:41.03 Author: Steven Lau (http://www.jguru.com/guru/viewbio.jsp?EID=72026) Question originally posed by Se Hee Lee (http://www.jguru.com/guru/viewbio.jsp?EID=21287 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.