एरर समाधान · ईमेल एरर

SMTP 501 Syntax Error in Parameters or Arguments

Fix SMTP 501 5.5.2 and 5.5.4 errors: bad HELO/EHLO names, malformed MAIL FROM or RCPT TO addresses, and broken AUTH responses, with test commands.

Error message501 Syntax error in parameters or arguments

लेखक: SiteDownCheck संपादकीय टीम · अपडेट: अक्टूबर 14, 2026 · 4 मिनट पढ़ने में

A 501 reply means the server understood the command but rejected what came after it. RFC 5321 defines the text as "Syntax error in parameters or arguments". The failure is on the sending side: your client, script or mail server sent a malformed argument. It is permanent for that session, so retrying with the same data fails again.

The enhanced code and message text point to the exact argument:

501 5.5.4 Invalid domain name
501 5.5.4 HELO/EHLO argument "localhost.localdomain" invalid, closing connection.
501 5.1.7 Invalid address
501 5.5.2 Syntax error, cannot decode response
501 5.5.4 Empty HELO/EHLO argument not allowed, closing connection.
postfix/smtpd[411]: NOQUEUE: reject: RCPT from unknown[203.0.113.9]: 501 5.1.3 Bad recipient address syntax; from=<> to=<bob@@example.com>

Gmail's documentation lists 501 5.5.2 (cannot decode response), 501 5.5.4 (HELO/EHLO invalid or empty) and 501 5.7.11 (no parameters allowed). Check Gmail's current SMTP error reference for exact text.

Causes, most likely first

  1. Invalid HELO/EHLO argument. An empty name, a bare IP without brackets, an underscore, or a name that is not a fully qualified domain name.
  2. Malformed envelope address in MAIL FROM or RCPT TO: missing angle brackets, spaces, double @, trailing dots, or an unescaped display name.
  3. Unsupported ESMTP parameters, such as SIZE= or BODY=8BITMIME sent to a server that did not advertise them.
  4. A broken AUTH exchange, where the base64 payload for AUTH PLAIN or AUTH LOGIN is wrong.
  5. Bad characters from application code, such as a newline in an address from user input.

Step 1: capture the actual SMTP conversation

Reproduce the dialogue by hand against the server and compare it with your client. Use OpenSSL for port 587 or 465, or nc for plain 25:

openssl s_client -starttls smtp -crlf -connect smtp.example.com:587
  # then type:
EHLO mail.yourdomain.com
MAIL FROM:<sender@yourdomain.com>
RCPT TO:<recipient@example.net>

If you see 501 at one of these lines, that line is wrong in your client. In your own MTA, increase logging (debug_peer_list in Postfix) or capture traffic. Check basic reachability with the पोर्ट चेकर.

Step 2: fix the HELO/EHLO name

Receivers expect an FQDN that resolves in DNS, ideally matching your reverse DNS. For Postfix set:

  # /etc/postfix/main.cf
myhostname = mail.example.com
smtp_helo_name = mail.example.com

Then reload with sudo postfix reload. Common mistakes: localhost, localhost.localdomain, the machine's internal name (web01), or a name with an underscore. Make sure mail.example.com has an A record and that the PTR of your IP points back; see reverse DNS (PTR) for email and test with the DNS चेकर.

Step 3: fix the addresses

An envelope address must look like <local@domain>. Strip display names ("Jane" <jane@example.com> is a header form, not an envelope form) and whitespace:

import re
addr = raw.strip().strip("<>").replace("\n", "")
assert re.fullmatch(r"[^@\s]+@[^@\s]+", addr)

Be careful with automated code: a trailing newline from a CSV or a form is enough to produce a 501 that looks like it comes from the server. For international addresses (non-ASCII local parts), the server must advertise SMTPUTF8; otherwise use IDNA/punycode for the domain part. Also remember that MAIL FROM:<> (the empty sender) is valid for bounces.

Step 4: ESMTP parameters and AUTH

Only use parameters the server advertised in its EHLO reply (SIZE, 8BITMIME, SMTPUTF8, AUTH). If your library adds BODY=8BITMIME to a server that does not support it, disable it or upgrade. For authentication, let the library handle encoding. If you build it yourself, AUTH PLAIN takes base64 of \0username\0password:

printf '\0user@example.com\0secret' | base64

A mismatch there gives a 501 5.5.2 style error. If the credentials are wrong but formatted correctly, you get a 535 instead; see SMTP 535 authentication failed.

How to verify

Replay the failing command in the manual session. A 250 reply means syntax is accepted. Then send a real message and confirm the log shows status=sent. Run the ईमेल डिलीवरेबिलिटी टेस्ट to confirm HELO, PTR and authentication together look healthy.

अगले कदम

सामान्य प्रश्न

Is 501 a server problem?

Usually not. It tells you the client sent a malformed argument. Rarely, an old or buggy server rejects a valid command, which you can show with a manual session.

What HELO name should I use?

The fully qualified hostname of your sending server, with a matching A record and PTR. Avoid localhost and bare IPs.

Why does the error mention "closing connection"?

Some servers end the session after a bad HELO because it signals a misconfigured or abusive client.

Does 501 mean the recipient is wrong?

Only if the text mentions the recipient address syntax. A nonexistent mailbox is a 550 5.1.1, not a 501.

Get notified when this fix updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.