SMTP error 504 5.7.4 means the server does not support the specific authentication mechanism
your client requested. The enhanced status code 5.7.4 is literally defined as "security
features not supported" - the server has authentication available, just not the particular
method (CRAM-MD5, NTLM, GSSAPI, a deprecated LOGIN variant) your client tried to use.
Fault: sender configuration. This has nothing to do with your username or password being
correct - the server never got far enough to check them.
Why it happens
- A mail library defaults to an older or stronger mechanism the server dropped. Some SMTP
clients default to CRAM-MD5 for perceived security, but many modern hosted mail providers
have removed it in favour of LOGIN/PLAIN over TLS, or OAuth-based XOAUTH2.
- A mismatch between the advertised and requested mechanism. The server's
EHLOresponse
lists exactly which AUTH mechanisms it supports on that connection (which can differ between
port 587 and 465, and before/after STARTTLS). A client that ignores this list and always sends
the same AUTH verb will eventually hit a server that does not offer it.
- Legacy relay software that only understands one mechanism talking to a modern server that
requires a different one, often surfaced after a provider deprecates basic LOGIN auth in
favour of OAuth.
- Connecting on the wrong port for the intended mechanism - some providers only offer certain
auth types pre-STARTTLS versus post-STARTTLS.
- A library configuration that lists mechanisms in a fixed preference order without checking
whether the first-preferred one is actually available on this specific connection, so it tries
and fails on the unsupported mechanism before ever attempting one that would have worked.
None of these causes are intermittent in the way a reputation-based failure would be. If a given
client and server combination produces 504 5.7.4 once, it will produce it every time under the
same configuration, which is itself a useful diagnostic signal: a consistently reproducible
failure points at a mechanism mismatch, not at anything transient on either end.
The transcript
$ swaks --to test@mailpilots.in --server smtp.example.net:587 \
--auth CRAM-MD5 --auth-user sender@yourdomain.com -tls
-> EHLO sender.example.com
<- 250-smtp.example.net Hello
<- 250-AUTH LOGIN PLAIN XOAUTH2
<- 250 STARTTLS
-> AUTH CRAM-MD5
<- 504 5.7.4 Unrecognized authentication typeThe EHLO response already told you the answer: AUTH LOGIN PLAIN XOAUTH2 was offered, and
CRAM-MD5 was not in that list. The server's complaint is accurate.
How the big three word it
| Provider | Typical reply | Notes |
|---|---|---|
| Gmail / Google Workspace | 504 5.7.4 Unrecognized authentication type | Google Workspace supports XOAUTH2 and app-password LOGIN/PLAIN; it has no CRAM-MD5 or NTLM support. |
| Microsoft 365 / Exchange Online | 504 5.7.4 Unrecognized authentication type | Identical phrasing; Exchange Online expects LOGIN or OAuth 2.0, and legacy NTLM-based clients increasingly fail here as Microsoft retires basic auth paths. |
| Self-hosted (Postfix/Dovecot SASL) | 504 5.5.4 Unrecognized authentication type (sometimes 5.5.4 instead of 5.7.4) | Dovecot's SASL layer reports exactly which mechanisms are compiled in; doveconf -n shows the active list. |
Diagnose it
$ swaks --to test@mailpilots.in --server smtp.example.net:587 -tls --quit-after EHLO -> EHLO sender.example.com <- 250-smtp.example.net Hello <- 250-AUTH LOGIN PLAIN XOAUTH2 <- 250 STARTTLS
--quit-after EHLO shows the advertised AUTH line without attempting a login at all - the
fastest way to confirm which mechanisms are actually on offer before changing any client
configuration.
The fix, in order
- Read the `EHLO` response first, every time, rather than guessing a mechanism.
- Switch your client's configured mechanism to one in the advertised list - almost always
LOGIN or PLAIN over TLS, or OAuth where the provider offers it.
- Confirm you are connecting over TLS before attempting `AUTH` at all. Several providers
only advertise authentication mechanisms after STARTTLS succeeds; a plaintext connection may
show a shorter AUTH line or none at all.
- Update the mail library if it hard-codes a mechanism with no fallback - most modern
libraries negotiate automatically from the EHLO response and only need the right credential
type configured.
- Move to OAuth where available, which sidesteps mechanism negotiation entirely for Gmail
and Outlook.
What not to do
- Do not change the password. The mechanism, not the credential, is the problem.
- Do not assume the account is misconfigured on the server side. The server told you exactly
what it supports in the same transcript that produced the error.
- Do not fall back to disabling TLS to try a different mechanism in plaintext - several
providers refuse authentication outright on an unencrypted connection, which produces a
different error, not a fix.
- Do not hard-code a single mechanism in custom scripts without first checking the
EHLO
response at connection time, since a provider can change its supported list without notice.
MailPilot's SMTP/IMAP connections negotiate authentication automatically against whatever the
provider's EHLO response advertises, and its OAuth-based Gmail and Outlook connections remove
mechanism negotiation from the picture entirely.
Ready to reach the inbox every time?
Automated email warmup across real peer mailboxes. Live inbox placement monitoring. Free 7-day trial - no credit card required.
Start free trial