Foros de discusión
unable to send mail from liferay portlet
devaraj s, modificado hace 10 años.
unable to send mail from liferay portlet
Regular Member Mensajes: 228 Fecha de incorporación: 21/05/12 Mensajes recientes
Hi , I have configured smtp in liferay control panel. I need to send a mail frm liferay portlet but I am facing exce[tion like unable to find valid certification path to requested target, Please can anyone let me know what is the issue.
here is my code,
Exception,
Thanks in advance
here is my code,
public void sendMail( ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException
{
MailMessage mailMessage = new MailMessage();
mailMessage.setHTMLFormat(true);
mailMessage.setBody("set body here");
mailMessage.setFrom(new InternetAddress("xx@gmail.com","xx"));
mailMessage.setSubject("set mail subject here");
try {
mailMessage.setTo(new InternetAddress("xyz@gmail.com"));
} catch (AddressException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MailServiceUtil.sendEmail(mailMessage);
System.out.println("mail sent!");
Exception,
ERROR [liferay/mail-1][MailEngine:567] Exception reading response
05:30:40,694 ERROR [liferay/mail-1][MailEngine:154] sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:289)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:200)
at sun.security.validator.Validator.validate(Validator.java:218)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1053)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:128)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:529)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:465)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1120)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:744)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
Thanks in advance
Bart Simpson, modificado hace 10 años.
RE: unable to send mail from liferay portlet
Liferay Master Mensajes: 522 Fecha de incorporación: 29/08/11 Mensajes recientes
Are you configuring the smtp server to be secured? Is it using SSL anywhere? That could be an issue.
devaraj s, modificado hace 10 años.
RE: unable to send mail from liferay portlet
Regular Member Mensajes: 228 Fecha de incorporación: 21/05/12 Mensajes recientesBart Simpson:
Are you configuring the smtp server to be secured? Is it using SSL anywhere? That could be an issue.
Thanks for response Bart Simpson, As your suggestion I have unchecked use secure network connection in control panel. Now I am not getting the above exception. my code exicuting without exception.
But I am not able get a mail to as I have set in my code. Please can you have a look on my code, is because of unchecking secure network connection or code issue ,mail is not getting?
Manish Yadav, modificado hace 10 años.
RE: unable to send mail from liferay portlet
Expert Mensajes: 493 Fecha de incorporación: 26/05/12 Mensajes recientes
It happens because of server has self signed certificate. To resolve issue you can add this certificate to the list of trusted certificates of your JVM. Check below URL for procedures to add certificates in JVM.
http://stackoverflow.com/questions/6908948/java-sun-security-provider-certpath-suncertpathbuilderexception-unable-to-find
http://magicmonster.com/kb/prg/java/ssl/pkix_path_building_failed.html
devaraj s, modificado hace 10 años.
RE: unable to send mail from liferay portlet
Regular Member Mensajes: 228 Fecha de incorporación: 21/05/12 Mensajes recientes
I agree for your point manish, I was succeded to send create account notification to user by setting smtp server details in control panel before. For that I have not configured any ssl security that time.
My question here is , Is we need to compulsarly follow ssl security to send a mail from liferay custom portlet? Why not needed any ssl configuration to get mail for account created notification? what is the difference here.
My question here is , Is we need to compulsarly follow ssl security to send a mail from liferay custom portlet? Why not needed any ssl configuration to get mail for account created notification? what is the difference here.
devaraj s, modificado hace 10 años.
RE: unable to send mail from liferay portlet
Regular Member Mensajes: 228 Fecha de incorporación: 21/05/12 Mensajes recientes
Its worked Thanks
sadhan paul, modificado hace 10 años.
RE: unable to send mail from liferay portlet
New Member Mensajes: 2 Fecha de incorporación: 24/10/13 Mensajes recientesdevaraj s:
Its worked Thanks
i am also facing same type of problem. can you tell the steps in details please...
Tibor Jándi, modificado hace 9 años.
RE: unable to send mail from liferay portlet
New Member Mensajes: 2 Fecha de incorporación: 29/09/11 Mensajes recientes
Please double check if there is a firewall that blocks the smtp.
I use Avast that causes this issue.
I use Avast that causes this issue.