Using MailScanner with Postfix
Postfix can be handled slightly differently from the other supported mail systems, as one copy of Postfix can handle both the incoming mail via SMTP, and the outgoing mail by doing all the delivery.
How to Set Up Postfix for MailScanner Use
– Install Postfix and get the basics working
– Make sure you have the chroot jail set up in /var/spool/postfix. You should be able to see “etc”, “usr” and “lib” directories inside /var/spool/postfix. If you haven’t got the chroot jail setup already, then look in the “examples” directory of the Postfix documentation and you will find a script in there to set up it up for your operating system.
– In the Postfix configuration file /etc/postfix/main.cf add this line:
header_checks = regexp:/etc/postfix/header_checks
– In the file /etc/postfix/header_checks add this line:
The effect of this is to tell Postfix to move all messages to the HOLD queue.
How to Set up MailScanner for Use with Postfix
In your MailScanner.conf file (probably in /etc/MailScanner or /opt/MailScanner/etc), there are 5 settings you need to change. They are all really near the top of the file. The settings are:
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix
You will need to ensure that the user “postfix” can write to /var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine:
chown postfix.postfix /var/spool/MailScanner/incoming
chown postfix.postfix /var/spool/MailScanner/quarantine
Starting It All Running
Most systems MailScanner can be restarted with one of the following commands:
Most RPM based systems:
Most Debian based systems:
If you have configured everything correctly, MailScanner should restart Postfix for you.
You may have read somewhere on Postfix.org that MailScanner shouldn’t be used with Postfix. This is not true. The people at Postfix insist we should use a milter instead of direct file management. The bottom line is that MailScanner has worked flawlessly with Postfix for over a decade.