Can anyone help me with any documentation for configuring email sending in AEMaaCS | Community
Skip to main content
Level 2
Jan 18, 2022 1:57 PM UTC
Solved

Can anyone help me with any documentation for configuring email sending in AEMaaCS

I found below document which talks about email configuration. However, I would like to know if we have any other documentation that can refer along with this.

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/developing/development-guidelines.html?lang=en#sending-email 

I would like to test with gmail account. Any help is really appreciated!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Jan 18, 2022 2:17 PM UTC

Hi @lmalyala 

 

You need to create one OSGi configuration with name "com.day.cq.mailer.DefaultMailService.xml" and add the below config into it.

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
smtp.host="smtp.gmail.com"
smtp.port="465"
smtp.user="demo@gmail.com"
smtp.password="Demo@123"
from.address="no-reply@gmail.com"
smtp.ssl="{Boolean}true"
smtp.starttls="{Boolean}true"
debug.email="{Boolean}true"/>

 

User name and password should be of the gmail account.

 

Please ensure to turn off the less secure app in gmail so it will not stop sending the email. Also note that you can send upto 500 emails using gmail account.

https://support.google.com/accounts/answer/6010255?hl=en

 

Thanks!

13 replies

Raja-Karuppsamy
New Participant
Jan 18, 2022 3:28 PM UTC

@lmalyala 

Please review the configuration in OSGi console - "Day CQ Mail Service" as below:

 

 

Please refer this article - https://www.albinsblog.com/2019/11/SMTPSendFailedException-Must-issue-a-STARTTLS-adobe-experience-ma...

 

Regards,

Raja

Translate
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Jan 18, 2022 2:17 PM UTC

Hi @lmalyala 

 

You need to create one OSGi configuration with name "com.day.cq.mailer.DefaultMailService.xml" and add the below config into it.

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
smtp.host="smtp.gmail.com"
smtp.port="465"
smtp.user="demo@gmail.com"
smtp.password="Demo@123"
from.address="no-reply@gmail.com"
smtp.ssl="{Boolean}true"
smtp.starttls="{Boolean}true"
debug.email="{Boolean}true"/>

 

User name and password should be of the gmail account.

 

Please ensure to turn off the less secure app in gmail so it will not stop sending the email. Also note that you can send upto 500 emails using gmail account.

https://support.google.com/accounts/answer/6010255?hl=en

 

Thanks!

Translate
lmalyalaAuthor
Level 2
Jan 18, 2022 10:11 PM UTC

Hey! This solution works perfectly in local instance. However, it is throwing below error in AEMaaCS instance. Looks like by default, ports will be disabled in AEMaaCS and needs to be enabled as per https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/networking/examples/email-service.html?lang=en 

Error in AEMaacs instance:

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

Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 465; timeout 60000

Caused by: java.net.SocketTimeoutException: connect timed out

Could you please help me with steps to resolve this issue in AEMaacs instance?

Translate
Asutosh_Jena_
New Participant
Jan 19, 2022 12:29 PM UTC

Hi @lmalyala 

 

You need to configure the OSGi details as mentioned below:

 

{
"smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"smtp.port": "30002",
"smtp.user": "$[env:EMAIL_USERNAME;default=apikey]",
"smtp.password": "$[secret:EMAIL_PASSWORD]",
"from.address": "no-reply@gmail.com",
"smtp.ssl": true,
"smtp.starttls": false,
"smtp.requiretls": false,
"debug.email": false,
"oauth.flow": false
}

 

Then you need to enable the ENV Variables using the Cloud Manager:

 

Once the Env variables are configured, Enable Environment Advanced Networking Configuration using Cloud Manager API and it should resolve the issue!

https://www.adobe.io/experience-cloud/cloud-manager/reference/api/#operation/enableEnvironmentAdvancedNetworkingConfiguration

 

 

Thanks! 

Translate
ibishika
Level 4
Jan 18, 2022 2:06 PM UTC