Example: Looking up a JavaMail session with JNDI
A program can conduct a JNDI lookup of a JavaMail resource. Deployment descriptors of the application determine the lookup name specified.
The following example shows a lookup of a JavaMail resource:
// Get the initial context as shown above ... Session session = (Session) initialContext.lookup("java:comp/env/mail/MailSession");
Related tasks
Developing applications that use JNDI
Reference topic