Tag Archives: postfix

Postfix and IPv6

Since I started using IPv6 I’ve noticed something, not all services use IPv6 by default. Now, this isn’t very strange. The strange this is me and how I forget to check it. Just now i discovered that my mail servers MTA, Postfix, wasn’t listening on IPv6. Of course I changed it so now it does.

Add the following lines to main.cf (mynetworks is probably there already, add your IPv6 network):

inet_protocols = all
mynetworks = 172.16.0.0/24 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 [2001:16d8:ccc9::]/64

This will enable both IPv4 and IPv6. Hopefully you’ll now be able to mail me via IPv6, which is nice.

Sort incoming spam with procmail

I’m using Spamassassin to fight spam on my mail server. All incoming spam is marked with [***** SPAM spamscore *****]. This is all good, but when you get a couple of hundred spam mails every day it gets annoying to sort them manually. This can be done automatically with procmail.

DEFAULT=$HOME/Maildir/
MAILDIR=$HOME/Maildir/

:0: 
* ^X-Spam-Status: Yes
.Spam/

This is my procmail configuration. It’s located in a file called .procmailrc in my home folder. It checks all incoming mail for the X-Spam-Status and if it’s marked as spam it’s moved to the maildir folder called .Spam in ~/Maildir (trailing slashes are important, they tell procmail I’m using maildir instead of mbox).

Now, there’s one last configuration needed. You have to tell postfix to use procmail. Add the following line to /etc/postfix/main.cf

mailbox_command = /usr/bin/procmail -f- -a "$USER"

Make sure there’s a maildir folder called .Spam in ~/Maildir, if not the spam mail won’t be saved and it will be lost. But hey, maybe that isn’t so bad? I want to save it to make sure I don’t lose any important stuff that’s marked as spam by mistake.