cancel
Showing results for 
Search instead for 
Did you mean: 

Send pdf by email

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

chintan_virani
Active Contributor
0 Kudos

Yuval,

Try using the IP address of the SMTP server.

Chintan