Hi Everyone,
I am working on custom work and need to send and email for approval. We are using ootb email configs. com.day.cq.mailer.DefaultMailService.cfg.json
{
"smtp.host": "$[env:PROJECT_SMTP_HOST]",
"smtp.port": "30465",
"smtp.user": "$[env:EMAIL_USERNAME]",
"smtp.password": "$[secret:EMAIL_PASSWORD]",
"from.address": "noreply@domain.com",
"smtp.ssl": true,
"smtp.starttls": false,
"smtp.requiretls": false,
"debug.email": false,
"oauth.flow": false
}
We have changed the smtp.host variable name to "PROJECT_SMTP_HOST" as mentioned in adobe document that
We have also enabled the port forwards and egress and whitelisting of IP.
Still getting the connection timeout.
Solved! Go to Solution.
Views
Replies
Total Likes
Your connection timeout is most likely related to the use of the smtp.host variable and network configuration in AEM as a Cloud Service. Here is a step-by-step guide with key pointers from internal knowledge and documentation:
You must NOT set a custom variable for the host unless you have specialized networking. The required and supported way to configure this for Cloud Service uses the internal proxy variable:
"smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]"
This is internally mapped to your chosen SMTP destination during advanced networking/port forwarding. Your custom variable PROJECT_SMTP_HOST will not be recognized by the proxy/tunnel networking AEM expects, and connection will not work.
In your config, you set "smtp.port": "30465". This value needs to match the "portOrig" you use in the Cloud Manager port forwarding configuration for your SMTP service.
Example (for SMTP over 465):
"portForwards": [ { "name": "smtp.sendgrid.net", "portDest": 465, "portOrig": 30465 } ]
Then, "smtp.port" in OSGi is 30465, NOT 465 or any custom value.
Just enabling port forward/egress is not enough: your Cloud Manager networking config must map the proxy port ("portOrig") to your SMTP server and port ("portDest"). This allows the service to tunnel through Adobe Cloud Service’s restricted egress layer.
Enable "debug.email": true in your config and check AEM logs for which hostname and port are being used at runtime. If you see "proxy.tunnel" or "AEM_PROXY_HOST" resolved to something unexpected or if you see a connection timeout to a private IP, this is a clear sign of misconfiguration in these two fields.
You should not use custom environment variable names (like "PROJECT_SMTP_HOST") for host mapping in Cloud Service. Adobe Cloud Service expects "AEM_PROXY_HOST" in the SMTP config to correctly route mail out.
{ "smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]", "smtp.port": "30465", "smtp.user": "$[env:EMAIL_USERNAME]", "smtp.password": "$[secret:EMAIL_PASSWORD]", "from.address": "noreply@domain.com", "smtp.ssl": true, "smtp.starttls": false, "smtp.requiretls": false, "debug.email": true, "oauth.flow": false }
Views
Replies
Total Likes
@deepikapatel could you share the complete Error Stack Trace?
Views
Replies
Total Likes
Hi @deepikapatel ,
The SMTP connection timeout in AEM as a Cloud Service usually happens due to one or more of the following issues — and from your config and setup.
1. Correct SMTP Configuration File
You're using com.day.cq.mailer.DefaultMailService.cfg.json — that's correct.
Double-check:
{
"smtp.host": "$[env:PROJECT_SMTP_HOST]",
"smtp.port": "30465",
"smtp.user": "$[env:EMAIL_USERNAME]",
"smtp.password": "$[secret:EMAIL_PASSWORD]",
"from.address": "noreply@domain.com",
"smtp.ssl": true,
"smtp.starttls": false,
"smtp.requiretls": false,
"debug.email": false
}
Confirm:
$[env:PROJECT_SMTP_HOST] is set in Cloud Manager pipeline variables.
$[secret:EMAIL_PASSWORD] is a secret variable (under secrets, not regular env vars).
"debug.email": true
...to your config temporarily. This will log SMTP connection activity in your logs (not password), and can reveal handshake failures, auth issues, or DNS problems.
Then go to:
AEM Runtime Logs (via Cloud Manager)
Look under error.log or stdout.log for SMTP debug lines
5. Custom Java Code
If using Java to trigger the email, make sure:
Message message = new MimeMessage(session);
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("someone@example.com"));
message.setSubject("Approval Required");
message.setText("Please approve the request.");
Transport.send(message); // This will hit the config above
Make sure you're not overriding the SMTP config programmatically unless you explicitly intend to.
Regards,
Amit
Views
Replies
Total Likes
Hi @deepikapatel ,
It looks like there might be an issue with the SMTP proxy tunnel on port 30465.
Can you please check with the Adobe team to confirm:
Is the SMTP proxy tunnel to port 30465 active and correctly routed for the PROJECT_SMTP_HOST environment variable?"
Regards,
Lavish Vasuja
Views
Replies
Total Likes
Your connection timeout is most likely related to the use of the smtp.host variable and network configuration in AEM as a Cloud Service. Here is a step-by-step guide with key pointers from internal knowledge and documentation:
You must NOT set a custom variable for the host unless you have specialized networking. The required and supported way to configure this for Cloud Service uses the internal proxy variable:
"smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]"
This is internally mapped to your chosen SMTP destination during advanced networking/port forwarding. Your custom variable PROJECT_SMTP_HOST will not be recognized by the proxy/tunnel networking AEM expects, and connection will not work.
In your config, you set "smtp.port": "30465". This value needs to match the "portOrig" you use in the Cloud Manager port forwarding configuration for your SMTP service.
Example (for SMTP over 465):
"portForwards": [ { "name": "smtp.sendgrid.net", "portDest": 465, "portOrig": 30465 } ]
Then, "smtp.port" in OSGi is 30465, NOT 465 or any custom value.
Just enabling port forward/egress is not enough: your Cloud Manager networking config must map the proxy port ("portOrig") to your SMTP server and port ("portDest"). This allows the service to tunnel through Adobe Cloud Service’s restricted egress layer.
Enable "debug.email": true in your config and check AEM logs for which hostname and port are being used at runtime. If you see "proxy.tunnel" or "AEM_PROXY_HOST" resolved to something unexpected or if you see a connection timeout to a private IP, this is a clear sign of misconfiguration in these two fields.
You should not use custom environment variable names (like "PROJECT_SMTP_HOST") for host mapping in Cloud Service. Adobe Cloud Service expects "AEM_PROXY_HOST" in the SMTP config to correctly route mail out.
{ "smtp.host": "$[env:AEM_PROXY_HOST;default=proxy.tunnel]", "smtp.port": "30465", "smtp.user": "$[env:EMAIL_USERNAME]", "smtp.password": "$[secret:EMAIL_PASSWORD]", "from.address": "noreply@domain.com", "smtp.ssl": true, "smtp.starttls": false, "smtp.requiretls": false, "debug.email": true, "oauth.flow": false }
Views
Replies
Total Likes