How can I configure postfix to allow relay for one specific recipient/destination email address?

ie flag

My postfix install denies relaying. But I'd like to configure it to make an exception for one specific destination address or a specific domain?

For example, allow relaying of all messages from anyone destined for [email protected] or, but continue to deny relaying for all other cases.

How would that exception be configured in postfix?

FatRabbit avatar
in flag
can you show us at least your postfix configuration?
us flag

allow relaying of all messages from anyone destined for [email protected] or

Which parameter is used to configure relaying based on destination domain is explained in the manual:

In other words, add to relayhost = separated with a comma and/or whitespace from any existing entries.

For a single address, no idea.

ie flag

some trial and error but finally figured this out.

tested and confirmed on postfix versions 2.10.1 and 3.4.13.

start with a postfix server that blocks all relays.

to allow relaying for one specific recipient address, such as [email protected], create a file like, /etc/postfix/relay_recipients.

in the file add the line: [email protected] x

then create a lookup table using this command:

postmap /etc/postfix/relay_recipients

then in add:

relay_domains =
relay_recipient_maps = hash:/etc/postfix/relay_recipients

restart postfix.

now postfix will continue to block all relays, except when the recipient email address is [email protected].


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.