What the message looks like
postfix/smtp[2314]: warning: SASL authentication failure: No worthy mechs found
postfix/smtp[2314]: 4F1A2B3C4D: SASL authentication failed; cannot authenticate to server smtp.example.com[203.0.113.10]: no mechanism availableCommon causes
- The package with the SASL mechanisms is missing:
libsasl2-modules. That gives “no mechanism available”. - The user name or password in
/etc/postfix/sasl_passwdis wrong, or the file was changed butpostmapwas not run. - The key in
sasl_passwddoes not matchrelayhostexactly, for example the square brackets or the port. - The provider offers login only over TLS, but
smtp_tls_security_levelis not set. smtp_sasl_security_optionsforbids the mechanism the provider offers.
Check
- Is the SASL module package installed?
dpkg -l | grep libsasl2-modules - Relay, SASL and TLS settings
postconf -n | grep -E 'relayhost|smtp_sasl|smtp_tls' - Does the stored key match the relay host?
sudo postmap -q '[smtp.example.com]:587' /etc/postfix/sasl_passwd - What does the log say?
Fix
- Install the modules:
apt install libsasl2-modules. - Set the relay with brackets and the port:
relayhost = [smtp.example.com]:587. - Enable login and TLS:
smtp_sasl_auth_enable = yes,smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd,smtp_sasl_security_options = noanonymous,smtp_tls_security_level = encrypt. - Put
[smtp.example.com]:587 user:passwordinsasl_passwd, thenpostmap /etc/postfix/sasl_passwdandchmod 600 /etc/postfix/sasl_passwd*. - Reload:
postfix reload, and test with a mail.
Typical scenario
Your home server is supposed to send mail through a provider such as Brevo or Mailgun because your internet connection blocks port 25. The log shows "SASL authentication failed; cannot authenticate to server smtp.example.com". In your mail program the same account works, though. Many providers require a separate SMTP password or an API key, not the login password of the web interface. First check in the provider's settings which SMTP credentials apply.
FAQ
What does “no mechanism available” mean?
Postfix has no usable SASL mechanism for this server. Either the plugin package is missing, or the server offers its mechanisms only after STARTTLS, which Postfix did not start.
How is this different from error 535?
With 535 the server answered and refused the credentials. Here Postfix could not even try.
Why does the account work in my mail client but not in Postfix?
The mail client may use other credentials or a sign-in method such as OAuth2, which Postfix cannot do by itself. Many providers require an app password or an API key for SMTP. Use exactly those in sasl_passwd.
Why must I run postmap after every change to sasl_passwd?
Postfix does not read the text file but the sasl_passwd.db generated from it. Without postmap /etc/postfix/sasl_passwd and a reload, the old password stays active. Also set chmod 600 on the files because they hold a plain-text password.
Which port should I use, 465 or 587?
For 587 Postfix uses STARTTLS, which needs smtp_tls_security_level = encrypt. Port 465 expects TLS from the first byte, so you also need smtp_tls_wrappermode = yes. The port in relayhost and in sasl_passwd must be the same.