This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
<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>
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("Email server is " + msession.getProperty("mail.smtp.host"));
This works fine on my development computer with Eclispse but failed once I deployed to the actual server.
with returns an exception: Could not connect to SMTP host: localhost, port: 25
My mail server is is not localhost so I put the pritnln statment to confirm that, and it is actuall localhost. I suspect that the server is totally locked down and firewalled by my IT department. Does any one know what is the context look up port so that I can try to open that port to see if it works.