Symptoms: mail to outside addresses fails with 554 5.7.1 Relay access denied, or a server that should accept mail for your domain refuses it.
What it means
Postfix has decided it is not allowed to relay that message. There are two directions:
- Sending out: the program sending the mail is not trusted (it did not sign in, or its address is not in
mynetworks). - Receiving in: the recipient's domain is not in the lists Postfix uses to accept mail (
mydestinationor the virtual domains).
Check the settings
postconf -n | grep -E "myhostname|myorigin|mydestination|relayhost|mynetworks"
A simple server that accepts mail for its own domain looks like this in /etc/postfix/main.cf:
myhostname = mail.example.com
myorigin = /etc/mailname
mydestination = localhost, example.com
relayhost =
myhostnameis the server's full name and should have matching DNS and reverse DNS.mydestinationlists the domains this server delivers locally. Your domain must be here (or invirtual_mailbox_domains/virtual_alias_domainsif you use virtual domains).relayhostis empty when the server sends mail itself, or[smtp.provider.com]:587when it sends through a provider.
If it is the sending side
Make the client sign in (SMTP authentication) on port 587 or 465, rather than adding wide ranges to mynetworks. Adding 0.0.0.0/0 creates an open relay and gets the server blocklisted.
Apply and test
postfix check
systemctl restart postfix
postqueue -f
Watch the log while you test: tail -f /var/log/mail.log.
Still failing?
Open a ticket with the output of postconf -n (remove any passwords) and the log lines around the failure.