Postfix Transport Not Getting Triggered

postfixsmtp

I have ServerA and ServerB – I'm moving accounts from A to B but I want ServerA to relay any mail it receives to ServerB to make sure no mail gets lost after I have copied mailboxes over while DNS propagates

On ServerA I have in main.cf:

transport_maps = hash:/etc/postfix/transport

and in that file I've tried:

user@domain.com smtp:[IP of serverB]:25

And running postmap /etc/postfix/transport, and restarting postfix

This doesn't seem to do anything. If I dont have a virtual alias created for the email it says the email doesn't exist in the virtual alias table (seemingly ignoring the mail transport config). If I do have an alias that works as normal but the transport is still ignored.

The only transport I can get working is a wildcard for all mail on the server – which isn't ideal..:

* smtp:[IP of serverB]:25

Which brings me on to my second problem – when that transport is triggered ServerB is rejecting the mail:

 Relay access denied (in reply to RCPT TO command)

On ServerB I've added the IP address to the mynetworks option. Am I missing more options somewhere?

Does ServerA need to authenticate on ServerB or is the mynetworks option enough?

ServerB is an ISPConfig install if that has any influence.

Any help greatly appreciated I've googled several tutorials and they all seem to just mention the options above so I don't know what's causing the issues

Best Answer

On server A, I'd try putting this into /etc/postfix/transport:

domain.com smtp:[IP of server B]

(run postmap on that file, etc). Assuming that server B is already set up to receive email for domain.com, that should be all you need.

If that's not working, here's what you should include to help with troubleshooting:

  • The output of postconf -n (replace your domain with example.com if you like) from servers A and B
  • The logs of an email received by server A for a user at domain.com
  • Logs from server B, if appropriate
  • The output of postmap -q someuser@domain.com hash:/etc/postfix/transport on server A