Skip to content

Linux - Ubuntu

External e-mails not delivering: "Relay access denied" (Postfix)

A Postfix server refuses to send to or accept mail for outside addresses. The usual settings to check.

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 (mydestination or 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 =
  • myhostname is the server's full name and should have matching DNS and reverse DNS.
  • mydestination lists the domains this server delivers locally. Your domain must be here (or in virtual_mailbox_domains / virtual_alias_domains if you use virtual domains).
  • relayhost is empty when the server sends mail itself, or [smtp.provider.com]:587 when 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.

Updated 2026-12-06

← All articles · Need a hand? Contact me.