Sunday, March 27, 2005

smtp proxy for sending mail


I have set up a server to scan all incoming mail, for viruses and spam, for my and some other people's domains.  This is running on an externally hosted VPS, and runs Maia Mailguard.  This works perfectly for all of my incoming mail


I wanted to also use this server to scan all of my outgoing mail as well, for two reasons:


  1. Help train the bayesian spam filter with the good messages that I send

  2. Potentially help reduce the risk of any of my machines being used to relay spam.





This wasn't hard to do, and I found most of the instructions here.


On the remote VPS, I change the smtpd_recipient_restrictions in Postfix's main.cf gile to:


smtpd_recipient_restrictions = permit_mynetworks, check_client_access hash:/etc/postfix/exchange, reject_unauth_destination, check_sender_access hash:/etc/postfix/access


The contents of /etc/postfix/exchange:


xx.xx.xx.xxx OK


I added this line to /etc/postfix/access:


xx.xx.xx.xxx RELAY


Where the ip address of the mail server that you want to relay mail for replaces the xxx.


Then on the mail server that will forward all mil to the remote VPS, I added the following line  to main.cf:


relayhost = vps.external.server.com