Monday, June 12, 2023

Postfix relay mail for different domains to different hosts

Postfix relay mail for different domains to different hosts

(can specify alternate ports too)

Something isn't quite right about this, it doesn't work.  

In main.cf:

relayhost = relayhost1.domain.com:25, 111.222.333.444:26

relay_domains = domain1.vu, domain2.co.nz, domain3.com.au, domain4.com, domain5.to

smtp_sender_dependent_authentication = yes

sender_dependent_relayhost_maps = hash:/etc/postfix/relaymap

In /etc/postfix/relaymap:
@domain1.vu    relayhost1.domain.com:25
@domain2.co.nz   relayhost1.domain.com:25
@domain3.com.au   111.222.333.444:26
@domain4.com   111.222.333.444:26
@domain5.to   relayhost1.domain.com:25

Then compile the relaymap txt file to a hash db so Postfix can use it:
postmap /etc/postfix/relaymap

Reload postfix config
postfix check && postfix reload

No comments:

Post a Comment

Powershell

Connect to your 365 instance. You have to do connect first, always.  Powershell ISE can't be used.  If you try you'll get a "A ...