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

Unable to send email from AEMCaas

Avatar

Level 1

Dear folks ,

We are using default mail service to send emails but we are facing issue to send emails. We have used below OSGI configuration and from local system we can send email but not from AEM cloud.
OSGI Config :

{
"smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"smtp.port": "30587",
"smtp.user": "$[env:EMAIL_USERNAME;default=1ec6dcbd9bf44864a6d506ae22d48026]",
"smtp.password": "$[secret:EMAIL_PASSWORD]",
"from.address": "abcd@xyz.com",
"smtp.starttls": true,
"smtp.requiretls": false,
"debug.email": false,
"oauth.flow": false
}


ERROR :

Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : proxy.tunnel:30587
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469) [org.apache.commons.email:1.5.0]
at org.apache.commons.mail.Email.send(Email.java:1496) [org.apache.commons.email:1.5.0]
at com.day.cq.mailer.impl.DefaultMailService.send(DefaultMailService.java:331) [com.day.cq.cq-mailer:5.4.22]
... 160 common frames omitted
Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: proxy.tunnel, 30587; timeout 60000
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2209) [com.sun.mail.javax.mail:1.6.2]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:740) [com.sun.mail.javax.mail:1.6.2]
at javax.mail.Service.connect(Service.java:388) [com.sun.mail.javax.mail:1.6.2]
at javax.mail.Service.connect(Service.java:246) [com.sun.mail.javax.mail:1.6.2]
at javax.mail.Service.connect(Service.java:195) [com.sun.mail.javax.mail:1.6.2]
at javax.mail.Transport.send0(Transport.java:254) [com.sun.mail.javax.mail:1.6.2]
at javax.mail.Transport.send(Transport.java:124) [com.sun.mail.javax.mail:1.6.2]
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459) [org.apache.commons.email:1.5.0]
... 162 common frames omitted
Caused by: java.net.UnknownHostException: proxy.tunnel

NOTE : We are using outlook as email service provider and we came to know from document that port 587 need to be enabled but not sure about that.
Any suggestion from anyone will be of great help to us.

Kind Regards,
Kaushik Datta

1 Accepted Solution

Avatar

Correct answer by
Level 9
3 Replies

Avatar

Level 9

@kdatta I tried below config and it worked for me in AEMaaCS

{
"debug.email": false,
"smtp.user": "$[secret:smtpuser]",
"smtp.password": "$[secret:smtppassword]",
"smtp.port": 465,
"smtp.ssl": true,
"smtp.starttls": true,
"smtp.host": "in.mailjet.com",
"from.address": "noreply@domain.com"
}

Their is a flexiablity in AEMaaCS that you can configure the smtp username and password from the environment variable as well  

Avatar

Level 1

Hi @Jagadeesh_Prakash ,

I tried with same config only as mentioned by you , only difference is 

smtp.ssl = false

as I am using outlook server . The problem was with port , by default 587 port is disabled , we need to enable that using advance networking.
 

Avatar

Correct answer by
Level 9