Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Not able to send mails using Gmail SMTP server

Avatar

Level 2

Hi,

I have configured CQ mail service for Gmail SMTP server for port 465 . But I am getting below error everytime. I have tried so many things but still getting the below error. I am woking on AEM 6.0. Please suggest me what could be the fix for the below problem.

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:25

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
0 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Level 10

See this article (similar on AEM 6 - if any difference):

http://therealcq.blogspot.ca/2013/01/setting-up-gmail-as-your-smtp-server-in.html

Also make sure that you specify your SMTP user name and password. 

Avatar

Level 2

Thanks for the reply.

I have done the similar configurations as given in the link , but still I am getting the below error.

 

Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
  nested exception is:
    java.net.ConnectException: Connection timed out: connect
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
    at javax.mail.Service.connect(Service.java:317)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:253)
    at javax.mail.Transport.send(Transport.java:124)
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1232)
    ... 132 more
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
    at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:299)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:208)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1927)
    ... 139 more

Please provide the solution for the same.

 

Thanks

Avatar

Level 10

Try building a custom eamil service within AEM:

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-email-services.html

This article walks you through how to do that. Then try connecting to the same SMTP server. Let us know what happens.