SMTP error 542
Not a real SMTP code — a blog "bad connection" label.
Updated Jul 1, 2026
SMTP 542 is not a reply code defined in RFC 5321, and its second digit "4" sits in an unassigned group, so a spec-compliant server does not emit it. It circulates on email blogs as a vague "bad connection" label. To fix a real rejection, find the actual 3-digit code and RFC 3463 enhanced status in your mail logs and act on that, most often a 5xx TLS, auth, or reputation failure.
Find the actual code and enhanced status and act on that.
What it means
There is no 542 reply code. RFC 5321 section 4.2.3 lists every code the protocol defines, and 542 is not one of them. The structure gives it away too. In sections 4.2.1 and 4.2.2 the first digit is the outcome (2yz success, 4yz transient, 5yz permanent) and the second digit is the subject group (x0z syntax, x1z information, x2z connections, x5z mail system). The second digit 4 is unassigned, so a compliant server will not send 542. The label shows up on email-tooling blogs as "bad connection", but none cite an RFC or a mainline provider such as SendGrid, SES, Mailgun, or Postmark that returns it. A few servers or anti-spam filters may put the digits 542 inside a custom rejection string like "542 Rejected", but that is a vendor message, not a standard code, and the fix depends entirely on the text that follows it.
Common causes
The rejection you actually got is a valid code such as 550, 554, 530, or a 4xx transient, and a tool or blog relabeled it 542. Find the real line in your logs.
The receiver blocked the message on reputation, blocklisting, or content. This gets mislabeled as a generic bad connection.
Per RFC 4954, the server requires valid SMTP credentials and refused because none were supplied.
A failed handshake on the submission port. Port 587 with STARTTLS and port 465 with implicit TLS are both valid per RFC 8314, and neither is deprecated.
A local policy decision from a specific product. The number is not a protocol code, so the words after it define what happened.
How to fix it
- Read the full server response
Find the complete line in your SMTP transcript or provider logs, for example "550 5.7.1 ..." or "421 4.7.0 ...". The first digit tells you whether to retry: 4yz is transient and safe to retry later, 5yz is permanent and needs a fix. The trailing dotted number is the RFC 3463 enhanced status.
- Handle a policy or reputation block
Authenticate your mail with SPF, DKIM, and DMARC, and check whether your sending IP or domain is on a blocklist.
- Handle "authentication required" (530 5.7.0)
Supply valid SMTP credentials. For Gmail and Google Workspace, use an App Password with 2-Step Verification or OAuth2. Google removed Less Secure Apps access in 2022, so do not rely on it.
- Handle a TLS failure
Connect on port 587 with STARTTLS or port 465 with implicit TLS. Both are valid and current per RFC 8314.
- Handle a vendor "542 Rejected" string
Act on the words after the number and check that product docs. It is a local policy decision, not a protocol error.
Common questions
Is SMTP Error 542 a standard SMTP reply code?
No. RFC 5321 section 4.2.3 defines no 542 code, and the second digit "4" falls in an unassigned group. It is a non-standard blog label, not a code mainstream servers or providers return.
What should I do when I see "SMTP Error 542"?
Ignore the 542 label and find the real 3-digit code and enhanced status in your logs. A 5xx means fix authentication, content, or reputation before resending. A 4xx is transient and safe to retry later.
Does "542 Rejected" from my mail server mean something specific?
Only to that server. It is a vendor rejection string, not a protocol code, so the meaning is in the human-readable text after the number and in that product documentation.