RE: SMTP configuration for Sendgrid

Shruti Mishra, modified 5 Years ago. New Member Posts: 22 Join Date: 4/24/15 Recent Posts
Hi,
LR version 7.2 GA1
We are trying to configure SMTP settings to send out emails from Form on portal.
However, the emails are not sent with Authentication Error.
Below are settings in portal-ext.properties

mail.session.mail.smtp.auth=true
mail.session.mail.smtp.host=smtp.sendgrid.net
mail.session.mail.smtp.password=********
mail.session.mail.smtp.port=587
mail.session.mail.smtp.user=something@azure.com
mail.transport.protocol=smtp
mail.smtp.starttls.enable=true
Error Log
2019-12-09 06:53:18.445 ERROR [liferay/mail-2][MailEngine:74] Unable to send message: null
javax.mail.AuthenticationFailedException
        at javax.mail.Service.connect(Service.java:306)
        at javax.mail.Service.connect(Service.java:156)
        at javax.mail.Service.connect(Service.java:105)
        at javax.mail.Transport.send0(Transport.java:168)
        at javax.mail.Transport.send(Transport.java:98)
        at com.liferay.petra.mail.MailEngine._send(MailEngine.java:627)
        at com.liferay.petra.mail.MailEngine.send(MailEngine.java:386)
        at com.liferay.petra.mail.MailEngine.send(MailEngine.java:461)
        at com.liferay.mail.messaging.MailMessageListener.doMailMessage(MailMessageListener.java:94)
        at com.liferay.mail.messaging.MailMessageListener.doReceive(MailMessageListener.java:109)
        at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
        at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
        at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:52)
        at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:752)
        at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:664)
        at java.lang.Thread.run(Thread.java:748)
Am I missing something in the property file?

Thanks .
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Shruti Mishra:

Hi,
LR version 7.2 GA1
We are trying to configure SMTP settings to send out emails from Form on portal.
However, the emails are not sent with Authentication Error.
According to the portal.properties documentation, those should be all.
What you can do is: Alternatively configure a connection on your appserver, and make it available through mail.session.jndi.name - this way you can test the connection on the appserver, plus you're not saving a cleartext password in Liferay's configuration.
Another idea: You've (correctly) masked out your password - make sure it doesn't contain anything nasty for the properties-formatting: E.g. if the password ends in a backslash, that might signal a linebreak in the properties file, instead of the literal character. I'm also never sure if/how/when something like \t is expanded to the tab character. Let alone other non-ASCII characters.
Ankit Kulshrestha, modified 5 Years ago. New Member Posts: 4 Join Date: 5/27/15 Recent Posts
Hi Shruti,

Send Grid mail servers run on SMTPS protocols, if you change the mail.transport.protocol=smtp to mail.transport.protocol=smtps that should do the trick. Let me know if you need more information on this.

Regards,

Ankit Kulshrestha
Shruti Mishra, modified 5 Years ago. New Member Posts: 22 Join Date: 4/24/15 Recent Posts
mail.transport.protocol=smtps   worked!!!
Thank you Ankit
thumbnail
Bangaru Raju Potnuru, modified 5 Years ago. New Member Posts: 22 Join Date: 11/22/14 Recent Posts
Hi ,
 I am trying to configure SMTP settings to send out emails from portal(Liferay 7.0  GA2
Here is the configuration I have done in portal-ext.properties file

mail.session.mail.smtp.auth=true
    mail.session.mail.smtp.host=smtp.sendgrid.net
    mail.session.mail.smtp.password=**********( Generated API KEY)
    mail.session.mail.smtp.port=587
    mail.session.mail.smtp.user=apikey
    mail.session.mail.store.protocol=smtps
    mail.session.mail.transport.protocol=smtp
    mail.smtp.starttls.enable=true
    mail.transport.protocol=smtps

I am getting the following error,thouugh im giving proper details.

13:57:25,538 ERROR [liferay/mail-1][MailEngine:77] null
javax.mail.AuthenticationFailedException
    at javax.mail.Service.connect(Service.java:306)
    at com.liferay.util.mail.MailEngine._send(MailEngine.java:554)
    at com.liferay.util.mail.MailEngine.send(MailEngine.java:354)
    at com.liferay.util.mail.MailEngine.send(MailEngine.java:429)
    at com.liferay.mail.messaging.MailMessageListener.doMailMessage(MailMessageListener.java:94)
    at com.liferay.mail.messaging.MailMessageListener.doReceive(MailMessageListener.java:109)
    at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
    at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
    at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:52)
    at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:756)
    at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:667)
    at java.lang.Thread.run(Thread.java:745)


Please help me out.Regards,
Raju