Score:0

Relay access denied error attempting to setup relay to another SMTP server

cn flag

I am attempting to setup 2 SMTP servers behind one firewall. One server for domainA.com and another for domainB.com. I want to configure the server for domainA.com to accept mail for domainB.com and forward it internally.

I have added the following setup in /etc/postfix/main.cf on domainA.com:

transport_maps =
    hash:/etc/postfix/transport
    proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf
    proxy:mysql:/etc/postfix/mysql/transport_maps_maillist.cf
    proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf

relay_domains =
    $mydestination
    hash:/etc/postfix/relay
    proxy:mysql:/etc/postfix/mysql/relay_domains.cf

relay_recipient_maps = hash:/etc/postfix/relay_recipients

relay_transport = relay

And in the referenced files:

/etc/postfix/relay

domainB.com

/etc/postfix/relay_recipients

@domainB.com x

/etc/postfix/transport

domainB.com     smtp:[192.168.0.236]

I have run postmap on each of these files.

Mail to/from domainA.com works fine. When I attempt to send mail to [email protected], it bounces with 554 5.7.1 <[email protected]>: Relay access denied

Paul avatar
cn flag
Is there anything in the logs on the domainB server?
cn flag
Nothing from domainA's IP, just local mails being delivered from Cron jobs to the postmaster inbox.
cn flag
I noticed I had received a warning when running `postmap` on `/etc/postfix/relay` about unexpected formatting, and now it appears I'm a step further. I changed it to `domainB.com x` and now I'm seeing the mail accepted and a connection open to the server for domainB!
Score:1
cn flag

I noticed I had received an error when running postmap:

postmap: warning: /etc/postfix/relay, line 1: expected format: key whitespace value

I changed the file to contain domainB.com x and re-ran postmap. It appears mail is now being accepted for relaying!

mangohost

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.