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 imap.phys.ethz.ch where
$Uis the first letter of the user name and
$USERis 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.
The folder "Foobar/Gnarz" of the user "example" is located on disk at
/var/imap/e/example/.Foobar.Gnarz/ on the server imap.phys.ethz.ch.
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.
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:
:0: * ^From:.*firstname.lastname@example.org /var/imap/u/user/.Friends.Alice/ :0: * ^From:.*email@example.com /var/imap/u/user/.Friends.Bob/