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 :
Solved! Go to Solution.
Views
Replies
Total Likes
@vivmishr we have defined in below manner , the problem was due to dedicated egress IP address was not whitelisted from Outlook server end . After whitelisting it worked well.
{
"smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"smtp.port": 30587,
"smtp.user": "$[env:EMAIL_USERNAME]",
"smtp.password": "$[secret:EMAIL_PASSWORD]",
"from.address": "xxxx@xxxx.com",
"smtp.ssl": false,
"smtp.starttls": true,
"smtp.requiretls":true
}
Thanks all of you for support.
@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
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.
@Jagadeesh_Prakash This is bad practise- you should not define host directly in config file in AEMaaCS. Rather use proxy.tunnel i.e. $[env:AEM_PROXY_HOST;default=proxy.tunnel]. Looks like you are not following the link you posted.
Anyone looking at this thread, please refer this blog post to enable flexible port egress: [0]. Also enable "debug.email": true in your DefaultMailService configuration. Once this is done- you can look at error logs to find out issue with email sending. In my case I saw this error:
"Caused by: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message"
So Disabled ssl like this- "smtp.ssl": false. It resolved the issue.
[0]- https://aem6solutions.blogspot.com/2023/04/enable-smtp-host-and-port-in-aem-cloud.html
@vivmishr we have defined in below manner , the problem was due to dedicated egress IP address was not whitelisted from Outlook server end . After whitelisting it worked well.
{
"smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]",
"smtp.port": 30587,
"smtp.user": "$[env:EMAIL_USERNAME]",
"smtp.password": "$[secret:EMAIL_PASSWORD]",
"from.address": "xxxx@xxxx.com",
"smtp.ssl": false,
"smtp.starttls": true,
"smtp.requiretls":true
}
Thanks all of you for support.
Yes, this is what the configuration format should be. Thank you for confirmation that this works. We should not put actual host and port in this config.
Views
Likes
Replies
Views
Likes
Replies