on 02-27-2008 9:56 AM
Hi
I am trying to run the tutorial
Offline interactive form based on sending and receiving emails
The problem I am facing is trying to get thru the company SMTP server. If I connect directly thru ADSL
using javamail everything is ok. But if I use the co. SMTP server I get the following exception:
Couldn't connect using "javax.net.ssl.SSLSocketFactory" socket factory to host, port: smtp.gmail.com, 465; Exception: java.lang.reflect.InvocationTargetException
//setup proxy params
props.put("http.proxySet", "true");
props.put("http.proxyHost", COMPANY_SMTP_HOST);
props.put("http.proxyPort", "25");
props.put("http.proxyUser", "");
props.put("http.proxyPassword", "");
// Setup mail server
props.put("mail.smtp.host", "smtp.gmail.com");
props.setProperty("mail.smtp.port", "465");
props.put("mail.smtp.starttls.enable","true");
System.setProperty("mail.smtps.auth", "true");
//props.put("mail.smtps.auth", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", SSL_FACTORY);
props.put("mail.smtp.socketFactory.fallback", "false");
props.put("mail.transport.protocol", "smtp");
Session session = Session.getInstance(props, new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username, password);
}
});
As the application naturally runs on the company server it has to use the compzsny SMTP server.
Thanks for your help
yuval
Yuval,
Try using the IP address of the SMTP server.
Chintan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.