AWS Security ChangesHomeSearch

AWS ses: SES SMTP guide adds credential security guidance

Service: ses · 2026-11-21 · Documentation medium

File: ses/latest/dg/send-using-smtp-programmatically.md · Type: credentials

Summary

Rewrites the SES SMTP sending guide to recommend Mail Manager or IAM SMTP credentials, use STARTTLS on port 587, avoid AWS access keys as SMTP credentials, and store SMTP credentials securely instead of hard-coding them.

Security assessment

The change documents secure handling of SMTP credentials, explicitly warning against hard-coded credentials and recommending AWS Secrets Manager. It also warns not to use AWS access keys as SMTP credentials, but there is no evidence it addresses a specific vulnerability or incident.

Evidence

+Do not store SMTP credentials in your source code. Use secure storage such as [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html). These examples are for testing in a non-production environment.

Diff

diff --git a/ses/latest/dg/send-using-smtp-programmatically.md b/ses/latest/dg/send-using-smtp-programmatically.md
index afb23ff..d0bacf2 100644
--- a//ses/latest/dg/send-using-smtp-programmatically.md
+++ b//ses/latest/dg/send-using-smtp-programmatically.md
@@ -9 +9 @@ Code examples
-# Sending emails programmatically through the Amazon SES SMTP interface
+# Sending emails programmatically over SMTP
@@ -11 +11 @@ Code examples
-To send an email using the Amazon SES SMTP interface, you can use an SMTP-enabled programming language, email server, or application. Before you start, complete the tasks in [Getting started with sending email](./getting-started-sending.html). You also need to get the following information: 
+Use an SMTP-enabled programming language or application to send email through Amazon SES. Before you start, complete the tasks in [Getting started with sending email](./getting-started-sending.html).
@@ -13 +13 @@ To send an email using the Amazon SES SMTP interface, you can use an SMTP-enable
-  * Your Amazon SES SMTP credentials, which enable you to connect to the Amazon SES SMTP endpoint. To get your Amazon SES SMTP credentials, see [Obtaining Amazon SES SMTP credentials](./smtp-credentials.html). 
+Get the SMTP endpoint, user name, and password from one of the following credential topics:
@@ -15 +15 @@ To send an email using the Amazon SES SMTP interface, you can use an SMTP-enable
-Important
+  * [Creating SMTP credentials using Mail Manager](./smtp-credentials-mail-manager.html) (recommended)
@@ -17 +17 @@ Important
-Your SMTP credentials are different from your AWS credentials. For more information about credentials, see [Types of Amazon SES credentials](./send-email-concepts-credentials.html).
+  * [Obtaining Amazon SES SMTP credentials using IAM](./smtp-credentials.html)
@@ -19 +18,0 @@ Your SMTP credentials are different from your AWS credentials. For more informat
-  * The SMTP endpoint address. For a list of Amazon SES SMTP endpoints, see [Connecting to an Amazon SES SMTP endpoint](./smtp-connect.html).
@@ -21 +19,0 @@ Your SMTP credentials are different from your AWS credentials. For more informat
-  * The Amazon SES SMTP interface port number, which depends on the connection method. For more information, see [Connecting to an Amazon SES SMTP endpoint](./smtp-connect.html).
@@ -23,0 +22 @@ Your SMTP credentials are different from your AWS credentials. For more informat
+The examples use STARTTLS on port `587`, which both SMTP options support. For other settings, see [Choose SMTP connection settings](./smtp-connect.html).
@@ -24,0 +24 @@ Your SMTP credentials are different from your AWS credentials. For more informat
+Important
@@ -26 +26 @@ Your SMTP credentials are different from your AWS credentials. For more informat
-## Code examples
+Do not use your AWS access key ID and secret access key as SMTP credentials. For more information, see [Types of Amazon SES credentials](./send-email-concepts-credentials.html).
@@ -28 +28 @@ Your SMTP credentials are different from your AWS credentials. For more informat
-You can access the Amazon SES SMTP interface by using an SMTP-enabled programming language. You provide the Amazon SES SMTP hostname and port number along with your SMTP credentials and then use the programming language's generic SMTP functions to send the email.
+## Code examples
@@ -30 +30 @@ You can access the Amazon SES SMTP interface by using an SMTP-enabled programmin
-Amazon Elastic Compute Cloud (Amazon EC2) restricts email traffic over port 25 by default. To avoid timeouts when sending email through the SMTP endpoint from Amazon EC2, you can request that these restrictions be removed. For more information, see [How do I remove the restriction on port 25 from my Amazon EC2 instance or AWS Lambda function?](https://aws.amazon.com/premiumsupport/knowledge-center/ec2-port-25-throttle/) in the AWS Knowledge Center.
+Provide the SMTP endpoint, port, user name, and password to your programming language's SMTP library. The library connects and sends the email.
@@ -32 +32 @@ Amazon Elastic Compute Cloud (Amazon EC2) restricts email traffic over port 25 b
-The code examples in this section for Java and PHP use port 587 to avoid this issue. 
+Amazon Elastic Compute Cloud (Amazon EC2) restricts email traffic over port `25` by default. To avoid timeouts, request removal of the restriction or use port `587`. For more information, see [How do I remove the restriction on port 25 from my Amazon EC2 instance or AWS Lambda function?](https://aws.amazon.com/premiumsupport/knowledge-center/ec2-port-25-throttle/) in the AWS Knowledge Center.
@@ -42 +42 @@ Warning
-Amazon SES does not recommend using static credentials. Refer to [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html) to learn how to improve your security posture by removing hard-coded credentials from your source code. This tutorial is only provided for the purpose of testing the Amazon SES SMTP interface in a non-production environment.
+Do not store SMTP credentials in your source code. Use secure storage such as [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html). These examples are for testing in a non-production environment.
@@ -47 +47 @@ Java
-This example uses the [Eclipse IDE](http://www.eclipse.org/) and the [JavaMail API](https://github.com/javaee/javamail/releases) to send email through Amazon SES using the SMTP interface.
+This example uses the [Eclipse IDE](http://www.eclipse.org/) and the [JavaMail API](https://github.com/javaee/javamail/releases) to send email through Amazon SES over SMTP.
@@ -51 +51 @@ Before you perform the following procedure, complete the tasks in [Getting start
-###### To send an email using the Amazon SES SMTP interface with Java
+###### To send an email over SMTP with Java
@@ -106 +106 @@ This tutorial requires JavaMail version 1.5 or later. These procedures were test
-        // Replace smtp_username with your Amazon SES SMTP user name.
+        // Replace smtp_username with the user name from your SMTP credentials.
@@ -109,4 +109,2 @@ This tutorial requires JavaMail version 1.5 or later. These procedures were test
-        // The name of the Configuration Set to use for this message.
-        // If you comment out or remove this variable, you will also need to
-        // comment out or remove the header below.
-        static final String CONFIGSET = "ConfigSet";
+        // The name of the configuration set to use for this message.
+        static final String CONFIGURATION_SET = "ConfigSet";
@@ -114,4 +112,2 @@ This tutorial requires JavaMail version 1.5 or later. These procedures were test
-        // Amazon SES SMTP host name. This example uses the US West (Oregon) region.
-        // See https://docs.aws.amazon.com/ses/latest/DeveloperGuide/regions.html#region-endpoints
-        // for more information.
-        static final String HOST = "email-smtp.us-west-2.amazonaws.com";
+        // Replace smtp_endpoint with the endpoint from your SMTP credentials.
+        static final String HOST = "smtp_endpoint";
@@ -119 +115 @@ This tutorial requires JavaMail version 1.5 or later. These procedures were test
-        // The port you will connect to on the Amazon SES SMTP endpoint. 
+        // Both SMTP credential types support STARTTLS on port 587.
@@ -122 +118 @@ This tutorial requires JavaMail version 1.5 or later. These procedures were test
-        static final String SUBJECT = "Amazon SES test (SMTP interface accessed using Java)";
+        static final String SUBJECT = "Amazon SES test email sent over SMTP";
@@ -151,3 +147,2 @@ This tutorial requires JavaMail version 1.5 or later. These procedures were test
-            // Add a configuration set header. Comment or delete the 
-            // next line if you are not using a configuration set
-            msg.setHeader("X-SES-CONFIGURATION-SET", CONFIGSET);
+            // Add the configuration set header.
+            msg.setHeader("X-SES-CONFIGURATION-SET", CONFIGURATION_SET);
@@ -166 +161 @@ This tutorial requires JavaMail version 1.5 or later. These procedures were test
-                // Connect to Amazon SES using the SMTP username and password you specified above.
+                // Connect using the SMTP endpoint, user name, and password specified above.
@@ -202 +197 @@ The email addresses are case-sensitive. Make sure that the addresses are exactly
-     * `smtp_username` – Replace with your SMTP user name credential. Note that your SMTP user name credential is a 20-character string of letters and numbers, not an intelligible name.
+     * `smtp_username` – Replace with the user name from your SMTP credentials.
@@ -206 +201 @@ The email addresses are case-sensitive. Make sure that the addresses are exactly
-  10. (Optional) If you want to use an Amazon SES SMTP endpoint in an AWS Region other than `email-smtp.us-west-2.amazonaws.com`, change the value of the variable `HOST` to the endpoint you want to use. For a list of regions where Amazon SES is available, see [Amazon Simple Email Service (Amazon SES)](https://docs.aws.amazon.com/general/latest/gr/rande.html#ses_region) in the _AWS General Reference_.
+  10. Replace `smtp_endpoint` with the endpoint from your SMTP credentials.
@@ -208 +203 @@ The email addresses are case-sensitive. Make sure that the addresses are exactly
-  11. (Optional) If you want to use a configuration set when sending this email, change the value of the variable `ConfigSet` to the name of the configuration set. For more information about configuration sets, see [Using configuration sets in Amazon SES](./using-configuration-sets.html).
+  11. (Optional) To use a configuration set, set `CONFIGURATION_SET` to its name. For more information, see [Specifying a configuration set when you send email](./using-configuration-sets-in-email.html).
@@ -226 +221 @@ PHP
-This example uses the PHPMailer class to send email through Amazon SES using the SMTP interface. 
+This example uses the PHPMailer class to send email through Amazon SES over SMTP.
@@ -245 +240 @@ In the preceding command, replace `path/to/` with the path where you installed C
-###### To send an email using the Amazon SES SMTP interface with PHP
+###### To send an email over SMTP with PHP
@@ -269 +264 @@ In the preceding command, replace `path/to/` with the path where you installed C
-    // Replace smtp_username with your Amazon SES SMTP user name.
+    // Replace smtp_username with the user name from your SMTP credentials.
@@ -272,2 +267 @@ In the preceding command, replace `path/to/` with the path where you installed C
-    // Specify a configuration set. If you do not want to use a configuration
-    // set, comment or remove the next line.
+    // The name of the configuration set to use for this message.
@@ -276,4 +270,4 @@ In the preceding command, replace `path/to/` with the path where you installed C
-    // If you're using Amazon SES in a region other than US West (Oregon),
-    // replace email-smtp.us-west-2.amazonaws.com with the Amazon SES SMTP
-    // endpoint in the appropriate region.
-    $host = 'email-smtp.us-west-2.amazonaws.com';
+    // Replace smtp_endpoint with the endpoint from your SMTP credentials.
+    $host = 'smtp_endpoint';
+    
+    // Both SMTP credential types support STARTTLS on port 587.
@@ -283 +277 @@ In the preceding command, replace `path/to/` with the path where you installed C
-    $subject = 'Amazon SES test (SMTP interface accessed using PHP)';
+    $subject = 'Amazon SES test email sent over SMTP';
@@ -286,2 +280,2 @@ In the preceding command, replace `path/to/` with the path where you installed C
-    $bodyText =  "Email Test\r\nThis email was sent through the
-        Amazon SES SMTP interface using the PHPMailer class.";
+    $bodyText =  "Email Test\r\nThis email was sent to Amazon SES over SMTP
+        using the PHPMailer class.";
@@ -291,3 +285,3 @@ In the preceding command, replace `path/to/` with the path where you installed C
-        <p>This email was sent through the
-        <a href="https://aws.amazon.com/ses">Amazon SES</a> SMTP
-        interface using the <a href="https://github.com/PHPMailer/PHPMailer">
+        <p>This email was sent to
+        <a href="https://aws.amazon.com/ses">Amazon SES</a> over SMTP
+        using the <a href="https://github.com/PHPMailer/PHPMailer">
@@ -307,0 +302,2 @@ In the preceding command, replace `path/to/` with the path where you installed C
+    
+        // Add the configuration set header.
@@ -339 +335 @@ In the preceding command, replace `path/to/` with the path where you installed C
-     * `smtp_username` – Replace with your SMTP user name credential, which you obtained from the [SMTP Settings](https://console.aws.amazon.com/ses/home?#smtp-settings:) page of the Amazon SES console. This is **not** the same as your AWS access key ID. Note that your SMTP user name credential is a 20-character string of letters and numbers, not an intelligible name.
+     * `smtp_username` – Replace with the user name from your SMTP credentials.
@@ -343 +339 @@ In the preceding command, replace `path/to/` with the path where you installed C
-     * (Optional) `ConfigSet` – If you want to use a configuration set when sending this email, replace this value with the name of the configuration set. For more information about configuration sets, see [Using configuration sets in Amazon SES](./using-configuration-sets.html).
+     * `smtp_endpoint` – Replace with the endpoint from your SMTP credentials.
@@ -345 +341 @@ In the preceding command, replace `path/to/` with the path where you installed C
-     * (Optional) `email-smtp.us-west-2.amazonaws.com` – If you want to use an Amazon SES SMTP endpoint in a Region other than US West (Oregon), replace this with the Amazon SES SMTP endpoint in the Region you want to use. For a list of SMTP endpoint URLs for the AWS Regions where Amazon SES is available, see [Amazon Simple Email Service (Amazon SES)](https://docs.aws.amazon.com/general/latest/gr/rande.html#ses_region) in the _AWS General Reference_.
+     * (Optional) `configurationSet` – To use a configuration set, set this value to its name. For more information, see [Specifying a configuration set when you send email](./using-configuration-sets-in-email.html).