How to Setup Your Own Procmail Filter Rules

This article provides the D-PHYS specific information needed to write proper procmail rules at the Department of Physics of the ETH Zurich.


  • We use the Maildir mailbox format, i.e. a mail folder is a real directory on the disk. procmail needs a trailing slash on the mailbox name to know it should handle the mailbox as Maildir format.
  • The path the to per-user directory is /var/imap/$U/$USER/ on the server where $U is the first letter of the user name and $USER is the user name.
  • IMAP uses the dot (".") as directory delimiter and this is used on the file system as well when it comes to folder names.

Path Example

The folder "Foobar/Gnarz" of the user "example" is located on disk at /var/imap/e/example/.Foobar.Gnarz/ on the server

You can login via SSH there, too.


If you want to write you own procmail rules, edit or create the file .procmailrc in your home directory.

.procmailrc Example

If you for example want to sort incoming mails from Alice and Bob in the subfolder Alice and Bob of the folder Friends, you can write a .procmailrc like this:

* ^From:.*

* ^From:.*

Further reading


Every locally delivered mail must pass a spamfilter. Individual users can adjust their personal SpamAssassin configuration using the file $HOME/.spamassassin/user_prefs. (You have to create that file if it doesn't exist.) The most typical entries are

blacklist_from  *

or required_score 5