Procmail - maildrop & Mail Filters


I have created a virtual user e-mail server with dovecot and postfix. Is there a way to use procmail for virtual users, or is there a rpm available to maildrop. Is there another another mail filter for Rocky 8 Linux?

Greg Ennis

I see I have it on ALmaLinux 8.6. It looks like I may have built it but I do have a spec file for version 3.0.0. that I apparently got from a .bz2 on courier’s site. The latest bz2 is apparently only available from sourceforge, though I haven’t looked too hard. Download Courier Mail Server from
The courier site says there are instructions on buildinig an rpm, but if I remember correctly, there was a specfile included with the tarball.

To update, I downloaded the latest maildrop (3.0.7.tar.bz2) untarred it and built it with rpmbuild -bb maildrop.spec. I did need the courier-unicode-devel as a dependency. I had already built an rpm of that, I don’t remember where I got it. I may have a rebuild of an older rpm. Anyway, once that was installled and I got the other dependencies with yum-builddep maildrop.spec the rpm built without trouble and I installed it with rpm -Uvh, again without problems.

Out of interest; if someone wanted to build a serious high traffic, world facing, mail server using RHEL 9, what packages would they choose? Or is it that RHEL 9 is not a very good choice for mail servers?


Thanks for letting me know. Looks like I will give maildrop a try. I would suggest that this is important enough it would be good if one of the Rocky repos would include maildrop for a dnf intsall.



Thanks for letting me know. Looks like I will give maildrop a try. I would suggest that this is important enough it would be good if one of the Rocky repos would include maildrop for a dnf intsall.


My pleasure. I don’t think RH has had it, though Fedora has, so I don’t
know it will get into RH. I agree though, there should be an official rpm.
I have submitted a request for an official epel package at 2091272 – Request for maildrop rpm for EPEL-8 (and courier-unicode-devel dependencies, so anyone with an interest in it, can add comments there.

I haven’t used it, but Dovecot includes Pigeonhole, a Sieve-based filter.

I added my name to your request! Thanks

It looks as if it’s been added to testing epel.
(same link as the one I posted previously)

I read the notice this morning and have been able to download teh rpms and install them with ‘dnf install *rpm’ without a problem. However I have not been ablle to make it work at all.

My set up is like the following,


I found one blurb that suggested I could use a .forward file to pipe the message throughj maildrop for one user.

I also tried
|/usr/bin/maildrop -d $(USER)

Neither of these locations seemed to work.
I also created anj
/etc/maildroprc file and put


if (/^X-SPAM: Spam*/)
to “$MAILHOME/$domain/$user/Maildir/Spam”
to “$MAILHOME/$domain/$user/Maildir”

allow_mail_to_commands = alias, forward, include
allow_mail_to_files = alias, forward, include
virtual_transport = maildrop
maildrop_destination_recipient_limit = 1

My contained
maildrop unix - n n - - pipe
flags=DRXhu user=vmail argv=/usr/bin/maildrop -d ${recipient}

If you can point my in the correct direction I would appreciate your help

Greg Ennis

I haven’t yet tried it, as my own builds are working for me. However, it might be worth commenting on the bug report. My own setup is quite simple, mostly using it for personal use with getmail. I have found a good way to test a .mailfilter config is to create a simple email, then run (assuming you call that mail testmail) cat testmail.txt |maildrop -V4 -d. That might help trouble shoot. I do use postfix for an almost unused account of mine, but the maildrop lines in my are commented out and just has
mailbox_command = /usr/bin/maildrop

Edit. I just installed the maildrop and courier rpms and it worked for me. I’m not an expert, so looking at what you have, I don’t see any obvious error. Hopefully, someone with more knowledge will chime in.

Thank you for your help !!!

You’re more than welcome, but I don’t think I helped much.

I finally got maildrop to work for content filtering within a postfix virtual domain, vitrual user e-mail server… Some key points that I had to overcome are:

  1. maildrop is now in the ‘epel’ repositories. Many thanks for doing this.

  2. The computer user for all virtual users is ‘vmail’

  3. The layout for the virtual users is

  4. The must contain
    virtual_transport = maildrop
    maildrop_destination_recipient_limit = 1
    home_mailbox = Maildir/

  5. The must contain
    maildrop unix - n n - - pipe
    flags=ODRhu user=vmail argv=/usr/bin/maildrop
    -d vmail ${user} ${domain}

The above is different than the documentation and was the key to making maildrop perform. What is documented is
maildrop unix - n n - - pipe
flags=ODRhu user=vmail argv=/usr/bin/maildrop
-d ${user}@${domain} ${extension} ${recipient} ${user} ${nexthop}

  1. There must be a file


SHELL=/bin/bash # default shell is usually /bin/sh
logfile “$HOME/$2/$1/maildrop.log”


echo “B Retcde=$RETURNCODE”
log “B Retcde=$RETURNCODE”

system ‘/bin/test -r $HOME/$2/$1/.mailfilter’

if( $RETURNCODE == 1 )
exception {
# The log entries have to be before the include file because if there is a
# match in the include file maildrop finishes and log entries would not be
# made if the log command goes after the include file.

echo "include : $HOME/$2/$1/.mailfilter"
log "include : $HOME/$2/$1/.mailfilter"
echo "C RtCd : $RETURNCODE"
log "C RtCd : $RETURNCODE"

echo “A Retcd=$RETURNCODE”
log “A Retcd=$RETURNCODE”

I have maildroprc owned by root using 644 as the protection

  1. For the virtual users that wnat that want content filtering a file labeled as .mailfilter should be created in the same directory as the directory Maildir/
    This file should be owned by ‘vmail’ with a group of ‘mail’ with a protection of 600

It should contain teh content filtering rules like
if (/^Subject:.[SPAM]*/:H)
to “$HOME/$2/$1/Maildir/.Spam”
if (/^Subject:.***SPAM*** */:H)
to “$HOME/$2/$1/Maildir/.Spam”

  1. I found it very hlpe to use teh maildrop command on teh command line to debug what variables it was using
    maildrop -V 10 -d vmail [] [virtual.user] < /etc/maildrop.test

Good Luck to the next person that uses maildrop to replace procmail for virtual users

Greg Ennis