Resolving SMTP connectivity failures in AEM as a Cloud Service

Adobe Experience Manager as a Cloud Service (AEMaaCS) can experience SMTP connection timeouts when connecting to external mail servers because direct outbound SMTP connections on non-HTTP ports are blocked by default. SMTP traffic must use the Advanced Networking egress proxy with a configured port forward. To resolve the issue, configure port forwarding and update the Day CQ Mail Service to use the proxy host and forwarded port.

Description description

Environment

  • Adobe Experience Manager as a Cloud Service (AEMaaCS)
  • Advanced Networking enabled

Issue/Symptoms

  • Email sending from AEM as a Cloud Service to external SMTP endpoints fails with connection timeouts.
  • AEM logs show errors such as MailConnectException and SocketTimeoutException.
  • The external mail server doesn’t receive any connection attempts.

Root cause

Direct outbound SMTP connections on non-HTTP ports are blocked by default in AEM as a Cloud Service. SMTP traffic must be routed through the Advanced Networking egress proxy using a configured port forward.

Resolution resolution

Follow the steps below to resolve the issue:

  1. In Cloud Manager, configure Advanced Networking port forwarding for each external SMTP endpoint that you need to reach. For example:

    code language-none
    {
      "nonProxyHosts": [ ] ,
      "portForwards": [
        {
          "name": "",
          "portDest": 587,
          "portOrig": 30587
        }
      ]
    }
    
    • Replace the example values with the actual SMTP host and choose an available internal port for portOrig.
    • Set portDest to match the SMTP port, typically 587.
    • Use portOrig as the internal port that AEM uses to connect through the proxy.
  2. Update the OSGi configuration for the Day CQ Mail Service (com.day.cq.mailer.DefaultMailService):

    code language-none
    {
      "smtp.host": "$[ env:AEM_PROXY_HOST;default=proxy.tunnel] ",
      "smtp.port": "30587", // Use the portOrig value from your port forward
      "smtp.user": "",
      "smtp.password": "$[ secret:SMTP_PASSWORD] ",
      "from.address": "user@example.com",
      "smtp.ssl": false,
      "smtp.starttls": true,
      "smtp.requiretls": true
    }
    
    • Replace example values, such as smtp.user and from.address, with your credentials and addresses.
    • Ensure that smtp.port matches the portOrig value in the port-forward configuration.
  3. Deploy the updated Cloud Manager and OSGi configurations to the AEM environments, Author and/or Publish, as needed.

  4. Test sending an email from AEM and confirm successful delivery through the external SMTP server.

  5. If the connection still times out:

    • Ask the external mail provider to allowlist the Adobe egress IP from the Advanced Networking configuration.
    • Confirm that the external mail provider sees incoming connection attempts on the SMTP port.
recommendation-more-help
experience-cloud-kcs-help-kbarticles