501 5.5.4: Invalid HELO/EHLO or command arguments
At a glance
- Type: permanent failure (class 5, RFC 3463 §2). The sending server does not retry; sending the same message again fails the same way until the cause is fixed.
- Basic code 501: “Syntax error in parameters or arguments” (RFC 5321 §4.2.3).
- Enhanced code 5.5.4: “Invalid command arguments” in the IANA registry (RFC 3463), in the group mail delivery protocol status (RFC 3463 §3.6).
A command your mail server sent had invalid arguments. Most often it is the greeting: the name your server gives in EHLO or HELO is empty or not a proper host name, so the receiving server refuses to talk to it.
What it means
RFC 3463 §3.6 defines X.5.4 as "invalid command arguments": a valid command was sent with arguments that were out of range or not recognized. It is only useful as a permanent error. The basic code 501 is "syntax error in parameters or arguments" (RFC 5321 §4.2.3).
The EHLO rules come from RFC 5321:
- §4.1.1.1: the argument is the client's fully qualified domain name. If it has no meaningful name, it should send an address literal, such as
[192.0.2.1]. - §4.1.4: the client must, if possible, use its primary host name. A server may check whether the name matches the client's IP address, but must not refuse mail only because it does not.
- §4.1.2: domain labels may contain only letters, digits and hyphens; an underscore is not allowed, and a server must reject such a command with 501.
Common causes
- EHLO sent with no argument at all.
- A bare machine name such as
server01,localhostor a Windows computer name instead of a full domain name. - A host name with an underscore, such as
mail_01.example.com. - An IP address written without the square brackets of an address literal.
- Other commands with bad arguments, such as an unknown parameter after
MAIL FROM.
How providers use it
Gmail returns 501 5.5.4 when the HELO or EHLO argument is invalid or empty (Google's SMTP error reference). Microsoft has a separate code, 5.7.506, for a bad HELO in which the sending server introduces itself with the name of the server it is connecting to (Exchange Online NDR reference).
How to fix it
- Find the EHLO name your server sends. It is in your mail server's settings, often called the host name, HELO name or SMTP banner name, and in the SMTP log.
- Set it to a full domain name you control, such as
mail.example.com. - Give that name an A or AAAA record pointing to the sending IP, and set the IP's reverse DNS (PTR) to the same name. Receivers check reverse DNS separately; see 550 5.7.25.
- If an application connects directly, set its EHLO name in its mail settings; if none is set, the library may send the machine's short name.
- If the error points to a different command, check that command's parameters against the server's EHLO reply, which lists the extensions it supports.
Related codes
- 503 5.5.1: Commands sent in the wrong order
- 550 5.7.25: Reverse DNS (PTR) check failed
- 553 5.1.3: The recipient address is not valid syntax
See every bounce code in the dictionary.
Many bounces from addresses that do not exist can be avoided: check an address with our free email checker, or clean a whole list before you send.
How we wrote this: drafted by the email-validation.org team with the help of AI writing tools, from our product documentation and the sources linked in the text.