I have a typical mail resource set up but my lookup always returns localhost as the smtp host.
My webapp contect.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> <context> <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="smtp.mydomain.com" mail.debug="true"></Resource> </context> My webapp web.xml has an entry like this: <resource-ref> <description>Resource reference to a factory for javax.mail.Session instances that may be used for sending electronic mail messages, preconfigured to connect to the appropriate SMTP server.</description> <res-ref-name>mail/Session</res-ref-name> <res-type>javax.mail.Session</res-type> <res-auth>Container</res-auth> </resource-ref> My webapp code Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); javax.mail.Session msession = (javax.mail.Session) envCtx.lookup("mail/Session"); System.out.println("msession to string is " + msession.getProperty("mail.smtp.host")); For some reasons, this work on my Eclipse/Tomcat set up but when I deploy everything to another server, the getProperty always return localhost as the smtp host. I search for all Tomcat log files but could not find anything. Any ideas? Thanks in advance! Alex