Looking up a JavaMail session with JNDI
The example below shows a lookup of a JavaMail resource. The actual lookup name is determined by the application's deployment descriptors.
Usage scenario
// Get the initial context as shown above ... Session session = (Session) initialContext.lookup("java:comp/env/mail/MailSession");
Developing applications that use JNDI