Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Kiran Kumar Boyini
com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1
January 28, 2013 4:19 AM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

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:
1
2       mail.session.mail.smtp.auth=false
3    mail.session.mail.smtp.host=smtp.gmail.com
4    mail.session.mail.smtp.port=25
5    mail.session.mail.transport.protocol=smtp
6    mail.session.mail.smtp.starttls.enable=true


I am using the gmail smtp server to send email.
In log file :
 1
 2
 3ERROR [MailEngine:507] 530 5.7.0 Must issue a STARTTLS command first. vq4sm6213584pbc.67 - gsmtp
 4
 512:06:03,609 ERROR [MailEngine:154] com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. vq4sm6213584pbc.67 - gsmtp
 6
 7    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
 8    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
 9    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
10    at javax.mail.Transport.send0(Transport.java:169)
11    at javax.mail.Transport.send(Transport.java:98)
12    at com.liferay.util.mail.MailEngine._send(MailEngine.java:493)
13    at com.liferay.util.mail.MailEngine.send(MailEngine.java:321)
14    at com.liferay.util.mail.MailEngine.send(MailEngine.java:390)
15    at com.liferay.mail.messaging.MailMessageListener.doMailMessage(MailMessageListener.java:95)
16    at com.liferay.mail.messaging.MailMessageListener.doReceive(MailMessageListener.java:110)
17    at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:25)
18    at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:65)
19    at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:106)
20    at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:669)
21    at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:580)
22    at java.lang.Thread.run(Thread.java:619)


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


Michael Wall
RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1
January 28, 2013 7:59 AM
Answer

Michael Wall

Rank: Junior Member

Posts: 56

Join Date: July 22, 2010

Recent Posts

Have you tried this:

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

props.put("mail.smtp.starttls.enable", "true");
Ketan Patel
RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1
January 28, 2013 10:16 PM
Answer

Ketan Patel

Rank: Junior Member

Posts: 70

Join Date: May 4, 2012

Recent Posts

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
RE: javax.net.ssl.SSLException in liferay 6.1
January 29, 2013 2:27 AM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

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 :

1
2MailMessage mailMessage = new MailMessage();
3        mailMessage.setHTMLFormat(true);
4        mailMessage.setFrom(new InternetAddress(fromMailId));
5        mailMessage.setTo(new InternetAddress(toMailId)); 
6        mailMessage.setSubject(subject); 
7        mailMessage.setBody(mailBody);                      
8        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
RE: javax.net.ssl.SSLException in liferay 6.1
January 29, 2013 10:06 PM
Answer

Ketan Patel

Rank: Junior Member

Posts: 70

Join Date: May 4, 2012

Recent Posts

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
RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1
January 30, 2013 1:43 AM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

Hi Patel,

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

Regards,

Kiran
Kiran Kumar Boyini
RE: com.sun.mail.smtp.SMTPSendFailedException in liferay 6.1
January 30, 2013 2:35 AM
Answer

Kiran Kumar Boyini

Rank: Expert

Posts: 277

Join Date: June 2, 2011

Recent Posts

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.

 1
 2mail.session.mail.smtp.auth=true
 3    mail.session.mail.smtp.host=smtp.gmail.com
 4    mail.session.mail.smtp.port=465
 5    mail.session.mail.smtp.user=username
 6    mail.session.mail.smtp.password=password
 7    mail.session.mail.smtp.ssl.enable=true
 8    mail.session.mail.transport.protocol=smtp
 9   

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
Attachments: mailConfigureasAdmin.bmp (3,075.1k)