Fórum

com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1

Kiran Kumar Boyini, modificado 11 Anos atrás.

com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
Hi All,

I am trying to use mail functionality in my portlet.But I am getting the above exception .I have tried so many so times
by changing the propeties in portal-ext.properties.But I am not able to resolve the above issue.

In portal-ext.properties:

       mail.session.mail.smtp.auth=false
	mail.session.mail.smtp.host=smtp.gmail.com
	mail.session.mail.smtp.port=25
	mail.session.mail.transport.protocol=smtp
	mail.session.mail.smtp.starttls.enable=true


I am using the gmail smtp server to send email.
In log file :


ERROR [MailEngine:507] 530 5.7.0 Must issue a STARTTLS command first. vq4sm6213584pbc.67 - gsmtp

12:06:03,609 ERROR [MailEngine:154] com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. vq4sm6213584pbc.67 - gsmtp

	at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
	at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
	at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
	at javax.mail.Transport.send0(Transport.java:169)
	at javax.mail.Transport.send(Transport.java:98)
	at com.liferay.util.mail.MailEngine._send(MailEngine.java:493)
	at com.liferay.util.mail.MailEngine.send(MailEngine.java:321)
	at com.liferay.util.mail.MailEngine.send(MailEngine.java:390)
	at com.liferay.mail.messaging.MailMessageListener.doMailMessage(MailMessageListener.java:95)
	at com.liferay.mail.messaging.MailMessageListener.doReceive(MailMessageListener.java:110)
	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:25)
	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:65)
	at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:106)
	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:669)
	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:580)
	at java.lang.Thread.run(Thread.java:619)



Please help me, am I missing any thing .
Regards,
Kiran


thumbnail
Michael Wall, modificado 11 Anos atrás.

RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1

Junior Member Postagens: 60 Data de Entrada: 22/07/10 Postagens Recentes
Have you tried this:

http://stackoverflow.com/questions/10509699/must-issue-a-starttls-command-first

props.put("mail.smtp.starttls.enable", "true");
Ketan Patel, modificado 11 Anos atrás.

RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1

Junior Member Postagens: 72 Data de Entrada: 04/05/12 Postagens Recentes
Hi Kiran,

I think you have set wrong smtp port number in portal-ext.properties file.

As per my knowledge it should be mail.session.mail.smtp.port=465

You can also configure SMTP instead of adding properties in portal-ext.properties file. Check out below blog.

http://ketanpatel88.blogspot.in/2012/11/if-you-want-tosend-email-from-your.html


Thanks,
Ketan Patel
Kiran Kumar Boyini, modificado 11 Anos atrás.

RE: javax.net.ssl.SSLException in liferay 6.1

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
Thanks all for reply,

Hi Ketan,as u said I followed the link and try to execute that code and configuration has done through the mail tab.
But i find that mails are not sending .I have got javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? error in log file

In action class :


MailMessage mailMessage = new MailMessage();
        mailMessage.setHTMLFormat(true);
        mailMessage.setFrom(new InternetAddress(fromMailId));
        mailMessage.setTo(new InternetAddress(toMailId));  
        mailMessage.setSubject(subject);  
        mailMessage.setBody(mailBody);                   	
        MailServiceUtil.sendEmail(mailMessage);

also I have set property in portal-ext.properties file
mail.session.mail.smtp.auth.plain.disable=true

Please help me , am i missing any thing or is it related to liferay problem.

Thanks,
Kiran
Ketan Patel, modificado 11 Anos atrás.

RE: javax.net.ssl.SSLException in liferay 6.1

Junior Member Postagens: 72 Data de Entrada: 04/05/12 Postagens Recentes
Hi Kiran,

As per the error it's look like, You are trying to do a SSL connection to a non-SSL port. This will not work.

Please remove all other mail related properties file you have added in portal-ext.properties file and then check.

If it is not working then try to add below lines in portal-ext.properties.

mail.session.mail.smtp.auth=true
mail.session.mail.smtp.ssl.enable=true


I have not tested it but check once.

Thanks,
Ketan Patel
Kiran Kumar Boyini, modificado 11 Anos atrás.

RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
Hi Patel,

As u said I have done the above.But still it is not working.
Help me....

Regards,

Kiran
Kiran Kumar Boyini, modificado 11 Anos atrás.

RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1

Expert Postagens: 287 Data de Entrada: 02/06/11 Postagens Recentes
Hi All...

Thanks to all for your reply...

Any I have done the mail configuration with gmail smtp server as admin in liferay.Please see the attachment.

Now it is working fine.But I am trying to configuring properties file.


mail.session.mail.smtp.auth=true
    mail.session.mail.smtp.host=smtp.gmail.com
	mail.session.mail.smtp.port=465
	mail.session.mail.smtp.user=username
    mail.session.mail.smtp.password=password
    mail.session.mail.smtp.ssl.enable=true
	mail.session.mail.transport.protocol=smtp
	

I have got this error:
Failed to connect to a valid mail server. Please make sure one is properly configured. Could not connect to SMTP host: localhost, port: 0
Tell me , the configuration for the same attachment in properties file.


Regards,

Kiran