In previous article we’ve installed spamassassin and pair it with Postfix.
It’s time to relay all external filtered emails to our exchange.
#Add transport file location to postfix file
echo "transport_maps = hash:/etc/postfix/transport" >> /etc/postfix/main.cf
#Change digitalbears.net to your domain
echo "relay_domains = digitalbears.net" >> /etc/postfix/main.cf
#Adding route to transport file, change cas-n01.digitalbears.net to your exchange server
echo "digitalbears.net smtp:cas-n01.digitalbears.net" >> /etc/postfix/transport
#Hashing our transport file
#By default Postfix will allow to relay emails from themselfe, we will change it to our Exchange Ip, change 172.17.14.23, 172.17.14.24 to your exchange servers IP or Subnet
sed -i -e "s/#mynetworks = 126.96.36.199\/28, 127.0.0.0\/8/mynetworks = 172.17.14.23, 172.17.14.24/g" /etc/postfix/main.cf
#Reload or restart postfix to pickup new config
systemctl restart postfix
From now your Postfix should relay all filtered by spamassassin emails to Microsoft Exchange, you can stop here or you can enable Postfix as Smart Host in Exchange send connector, relay for exchange already configured above.