What the message looks like
postfix/smtpd[2210]: NOQUEUE: reject: RCPT from client.example.net[203.0.113.20]: 554 5.7.1 <user@example.org>: Relay access denied; from=<me@example.com> to=<user@example.org> proto=ESMTP helo=<client>Common causes
- The mail client or app does not authenticate, or uses port 25 where login is not offered. Use the submission port 587 with login.
smtpd_relay_restrictionslackspermit_sasl_authenticated, so even logged-in users are refused.- The recipient domain is yours, but it is not listed in
virtual_mailbox_domains,mydestinationorrelay_domains. - The sending host is a trusted internal machine, but its address is not in
mynetworks. - A typo in the recipient domain, or an MX record that points to this server for a domain it should not serve.
Check
- Relay and recipient rules in effect
postconf -n | grep -E 'smtpd_relay_restrictions|smtpd_recipient_restrictions|mynetworks' - Which domains does this server accept?
postconf -n | grep -E 'mydestination|virtual_mailbox_domains|virtual_alias_domains|relay_domains' - Is login enabled on the submission service?
postconf -P submission/inet/smtpd_sasl_auth_enable - The rejections in the log
Fix
- For your users, make them send through port 587 with STARTTLS and a login, not over port 25 without login.
- Allow logged-in users:
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination, and enablesmtpd_sasl_auth_enable = yeson the submission service inmaster.cf. - If the recipient domain should be delivered here, add it to
virtual_mailbox_domains(ormydestination), but to only one of them, thenpostfix reload. - For one trusted internal host, add only that address to
mynetworks. Never add wide ranges or0.0.0.0/0. - Send a test again and check that the log line is gone.
FAQ
Does this mean my server is an open relay?
No, the opposite. This message is the protection working. You only need to act if your own users or your own domain are being refused.
Why does it only happen for some recipients?
Mail to your own domains is accepted, mail to other domains needs authentication. So local recipients work, and external ones get this error until the client logs in.