SMTP code 504 means the server recognizes the command but does not support a specific parameter or extension that was included. This is narrower than 502 (entire command not implemented) — the command works, but a particular option does not. The most common trigger is requesting an unsupported authentication mechanism (e.g., AUTH GSSAPI on a server that only supports PLAIN and LOGIN) or using an unrecognized ESMTP parameter in MAIL FROM. The client should retry with a supported parameter.
The client requested authentication using a mechanism the server does not support (e.g., AUTH NTLM, AUTH GSSAPI, AUTH XOAUTH2). The server's EHLO response lists supported mechanisms after the AUTH keyword — the client must use one of those.
The client included an ESMTP extension parameter in the MAIL FROM command that the server does not implement. For example, MAIL FROM:<[email protected]> SMTPUTF8 on a server that does not support internationalized email addresses.
The BODY= parameter in MAIL FROM specifies the message encoding (7BIT or 8BITMIME). If the client requests 8BITMIME and the server does not advertise it, 504 is returned.
Send EHLO and review the capability list. For AUTH, look for the line 'AUTH PLAIN LOGIN CRAM-MD5' (or whatever mechanisms are supported). For other extensions, check SIZE, 8BITMIME, SMTPUTF8, etc.
openssl s_client -connect mail.example.com:587 -starttls smtp
Try AUTH PLAIN or AUTH LOGIN, which are the most widely supported mechanisms. Encode credentials in base64 as required by the mechanism.
Simplify your MAIL FROM command to only include parameters the server advertises. Use MAIL FROM:<[email protected]> without extra parameters if you are unsure.
The SMTP server recognized the command but has not implemented it or has disabled it.
The SMTP authentication credentials were rejected. The username, password, or token is incorrect.
The SMTP command was recognized but the parameters or arguments are malformed or invalid.