Why do I get an "Invalid MAIL FROM" or "Invalid RCPT TO" error response from an Amazon SES SMTP endpoint?

2 minute read
0

When I use an Amazon Simple Email Service (Amazon SES) SMTP endpoint to send emails, I get the "501 Invalid MAIL FROM address provided" error response. Or, I get the "501 Invalid RCPT TO address provided" error response.

Short description

When you use an Amazon SES SMTP endpoint to send emails, there's a SMTP handshake process. The handshake process includes specific commands, such as EHLO, MAIL FROM, RCPT TO, and DATA, that are exchanged between the sender and the server (SES). The server responds with codes that indicate the success or failure of each command.

If there are issues with the syntax or parameters in the commands from the client, then the servers respond with the 501 error code.

Resolution

Review the format of the commands that are used in the handshake process. Syntax or parameter issues in the MAIL FROM or RCPT TO commands can cause the error response.

In the following example commands, the 501 error occurs because the commands aren't formatted correctly:

MAIL FROM: SES (<user1@example. com>)
RCPT TO: User2

The MAIL FROM or RCPT TO commands that the email application sends must be a valid email address. The following are examples of valid MAIL FROM and RCPT TO addresses:

MAIL FROM: user1@example.com
RCPT TO: user2@example.com

Related information

Reply codes in numeric order on the IETF Datatracker website

AWS OFFICIAL
AWS OFFICIALUpdated 10 days ago