503 5.5.1 Bad sequence of commands
Meaning
Your mail server sent SMTP commands in the wrong order, causing the receiving server to abort the transaction.
Common causes
- Sending the DATA command before specifying a sender (MAIL FROM) or recipient (RCPT TO).
- Attempting to authenticate after the mail transaction has already started.
- A bug in the custom script or application generating the SMTP connection.
How to fix
- Ensure your application follows the standard SMTP sequence: EHLO, AUTH, MAIL FROM, RCPT TO, DATA.
- If you are writing a custom SMTP client, review RFC 5321.
- Use an established email library instead of manually opening sockets and sending raw SMTP commands.
Example bounce
503 5.5.1 Bad sequence of commands.
FAQ
- Why does this happen with my custom script?
- SMTP is a stateful protocol. You cannot send a message body until the server has acknowledged the sender and recipient. If your script doesn't wait for responses, it will trigger this error.