commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laxmilal Menaria <lmena...@chambal.com>
Subject Mails doesn't send with commons-email1.1
Date Fri, 30 Jan 2009 06:32:59 GMT
Hello every one,

I have created a sample application with using commans-email 1.1 api like
this

Email email = new SimpleEmail();
String authuser = "......@gmail.com";
String authpwd = "*********";
// Very Important, Don't use email.setAuthentication()
email.setSmtpPort(465);
email.setAuthenticator(new DefaultAuthenticator(authuser, authpwd));
email.setDebug(true); // true if you want to debug
email.setHostName("smtp.gmail.com");

email.getMailSession().getProperties().put("mail.smtp.auth", "true");
email.getMailSession().getProperties().put("mail.debug", "true");
email.getMailSession().getProperties().put("mail.smtp.port", "465");
email.getMailSession().getProperties().put("mail.smtp.socketFactory.port",
"465");
email.getMailSession().getProperties().put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
email.getMailSession().getProperties().put("mail.smtp.socketFactory.fallback",
"false");
email.getMailSession().getProperties().put("mail.smtp.starttls.enable",
"true");
email.setFrom("........@gmail.com", "SenderName");
email.setSubject("TestMail");
email.setMsg("This is a test mail?");
email.addTo(".............@gmail.com", "ToName");
email.send();

But When I run it its shows me the exception and mail does't send so what
can I do ?

Exception :

*org.apache.commons.mail.EmailException: Sending the email to the following
server failed : [SERVER]:[PORT]*

Please suggest me. I have tried with Cystaltech server/Gmail server. Same
crystal tech server is working with .Net application with smae setting.


-- 
Thanks,
Laxmilal menaria

http://www.bucketexplorer.com/
http://www.sdbexplorer.com/
http://www.chambal.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message