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 = "[email protected]"; > 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("[email protected]", "SenderName"); > email.setSubject("TestMail"); > email.setMsg("This is a test mail?"); > email.addTo("[email protected]", "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: [email protected] For additional commands, e-mail: [email protected]
