commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Siegfried Goeschl <siegfried.goes...@it20one.at>
Subject Re: Mails doesn't send with commons-email1.1
Date Fri, 30 Jan 2009 10:31:01 GMT
Hi,

after a quick look I have the following comments

+) the way set up the email looks a bit odd
"email.getMailSession().getProperties.put" versus "email.setSSL" - maybe
you double-check if using the exposed API solves the problem

+) you are using SSL so your application needs to accept the server
certificate - I think you need to import the cert into your Java
keystore or define your own trust store. When tinkering with keystores I
recommend using Portecle (http://portecle.sourceforge.net/)

Cheers,

Siegfried Goeschl

Laxmilal Menaria wrote:
> 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.
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message