Testing your connection to the Amazon SES SMTP interface using the command line - Amazon Simple Email Service

Testing your connection to the Amazon SES SMTP interface using the command line

You can use the methods described in this section from the command line to test your connection to the Amazon SES SMTP endpoint, validate your SMTP credentials, and troubleshoot connection issues. These procedures use tools and libraries that are included with most common operating systems.

For additional information about troubleshooting SMTP connection problems, see Amazon SES SMTP issues.

Prerequisites

When you connect to the Amazon SES SMTP interface, you have to provide a set of SMTP credentials. These SMTP credentials are different from your standard AWS credentials. The two types of credentials aren't interchangeable. For more information about obtaining your SMTP credentials, see Obtaining Amazon SES SMTP credentials.

Testing your connection to the Amazon SES SMTP interface

You can use the command line to test your connection to the Amazon SES SMTP interface without authenticating or sending any messages. This procedure is useful for troubleshooting basic connectivity issues. If your test connection fails, see SMTP issues.

This section includes procedures for testing your connection using both OpenSSL (which is included with most Linux, macOS, and Unix distributions, and is also available for Windows) and the Test-NetConnection cmdlet in PowerShell (which is included with most recent versions of Windows).

Linux, macOS, or Unix

There are two ways to connect to the Amazon SES SMTP interface with OpenSSL: using explicit SSL over port 587, or using implicit SSL over port 465.

To connect to the SMTP interface using explicit SSL
  • At the command line, enter the following command to connect to the Amazon SES SMTP server:

    openssl s_client -crlf -quiet -starttls smtp -connect email-smtp.us-west-2.amazonaws.com:587

    In the preceding command, replace email-smtp.us-west-2.amazonaws.com with the URL of the Amazon SES SMTP endpoint for your AWS Region. For more information, see Regions and Amazon SES.

    If the connection was successful, you see output similar to the following:

    depth=2 C = US, O = Amazon, CN = Amazon Root CA 1 verify return:1 depth=1 C = US, O = Amazon, OU = Server CA 1B, CN = Amazon verify return:1 depth=0 CN = email-smtp.us-west-2.amazonaws.com verify return:1 250 Ok

    The connection automatically closes after about 10 seconds of inactivity.

Alternatively, you can use implicit SSL to connect to the SMTP interface over port 465.

To connect to the SMTP interface using implicit SSL
  • At the command line, enter the following command to connect to the Amazon SES SMTP server:

    openssl s_client -crlf -quiet -connect email-smtp.us-west-2.amazonaws.com:465

    In the preceding command, replace email-smtp.us-west-2.amazonaws.com with the URL of the Amazon SES SMTP endpoint for your AWS Region. For more information, see Regions and Amazon SES.

    If the connection was successful, you see output similar to the following:

    depth=2 C = US, O = Amazon, CN = Amazon Root CA 1 verify return:1 depth=1 C = US, O = Amazon, OU = Server CA 1B, CN = Amazon verify return:1 depth=0 CN = email-smtp.us-west-2.amazonaws.com verify return:1 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-d-VCSHDP1YZ A1b2C3d4E5f6G7h8I9j0

    The connection automatically closes after about 10 seconds of inactivity.

PowerShell

You can use the Test-NetConnection cmdlet in PowerShell to connect to the Amazon SES SMTP server.

Note

The Test-NetConnection cmdlet can determine whether your computer can connect to the Amazon SES SMTP endpoint. However, it doesn't test whether your computer can make an implicit or explicit SSL connection to the SMTP endpoint. To test an SSL connection, you can install OpenSSL for Windows to send a test email.

To connect to the SMTP interface using the Test-NetConnection cmdlet
  • In PowerShell, enter the following command to connect to the Amazon SES SMTP server:

    Test-NetConnection -Port 587 -ComputerName email-smtp.us-west-2.amazonaws.com

    In the preceding command, replace email-smtp.us-west-2.amazonaws.com with the URL of the Amazon SES SMTP endpoint for your AWS Region, and replace 587 with the port number. For more information about regional endpoints in Amazon SES, see Regions and Amazon SES.

    If the connection was successful, you see output that resembles the following example:

    ComputerName : email-smtp.us-west-2.amazonaws.com RemoteAddress : 198.51.100.126 RemotePort : 587 InterfaceAlias : Ethernet SourceAddress : 203.0.113.46 TcpTestSucceeded : True