Sending fails with “Relay access denied”
A mail client or device sending through your server gets 554 5.7.1 Relay access denied. Postfix relays mail to other domains only for senders who log in or send from trusted networks, so set the client to log in.
Symptoms
The server refuses mail to email addresses at other domains with this reply.
554 5.7.1 <someone@example.org>: Relay access deniedThe mail log shows the same reply for each attempt. The log is /var/log/maillog on AlmaLinux and /var/log/mail.log on Ubuntu.
grep 'Relay access denied' /var/log/maillogCause
Postfix relays mail to other domains only for senders who log in with SMTP authentication and for the trusted networks an administrator lists. When a client sends on port 25 without logging in, the server refuses every recipient outside its own domains.
The same reply appears for a domain whose mail routing is set to remote. The server refuses mail for that domain.
Resolution
Set the mail client to send on port 587 with STARTTLS or on port 465 with SSL/TLS. Enable authentication and use the full email address as the username and the mail account's password.
If a device cannot log in, add its network to the trusted networks. A printer or an application server with a fixed IP address can then relay mail without logging in.
urbestack-setting-set --key mail.trusted_networks --json --value '["203.0.113.0/24"]'Check the networks Postfix trusts. The output should include the network you added.
postconf -h mynetworksList only networks you control. Every machine in those networks can send mail through your server.