Per-User Maildrop Mail Filtering for Postfix w/ Virtual Users

Last year, I set up an “ISP-level” mail system for myself. Well, it seemed to me like I had some pretty common requirements: being able to handle mail for multiple domains without having to create UNIX accounts, and secure logins. Despite “email” being 30 years old, however, it turned out that there was no simple package that I could apt-get to install this. Instead, I ended up almagating various tutorials/packages for my Postifx w/ SASL + Courier IMAP w/ SSL + MySQL configuration.

One piece I wasn’t able to set up, however, was virtual user mail filtering. I banged my head until finding out there was just no way to do procmail delivery w/o an associated UNIX home folder. After which, I moved on to looking at how maildrop might work, but after many fruitless hours I gave up.

Recently, I decided it was time to get it working, no matter how long it took, and after a few hours of hammering away, I finally have gotten it done.

  • If you have a setup like mine setup except for maildrop, this is the clearest tutorial.
  • If you’re running Debian, you’re going to need to compile your own Maildrop w/ MySQL support enabled. Note, that Maildrop 1.7.0 is the last version that has built-in MySQL support; after that version, Maildrop switches to using Courier authlib for connecting. I have the authlib stuff set up for my IMAP/POP, but I couldn’t get Maildrop to connect properly!
  • test your maildrop setup separately as root:
    maildrop -V 10 -d user@domain.tld < test.eml
  • If you get an maildrop: signal 0x0B error, use strace to see what's going on. Maildrop segfaults on bad configs. Also, be sure to turn on MySQL logging to see what query maildrop is actually performing