Server-side mail folder sorting with .procmail

If you have an ISP like Sonic.net with an IMAP mail server that allows you to edit your .procmail folder, there’s a nifty trick you can use to move E-Mail into folders, i.e. without your client even needing to connect.  This can be handy if you subscribe to mailing lists that you’re interested in keeping up with but perhaps don’t want to be notified about at 2 AM.

Here are a couple of .procmail example sections:

:0: H
* ^Subject:.*(CRIU)
${DEFAULT}.CRIU/

This matches on all mail that comes in with a subject containing the string “CRIU” and places it in a folder named CRIU (which you should create before applying this rule). Saving the file is all that is required – the next incoming message will be silently placed in the folder without hitting your main inbox, and if you only monitor E-Mails in your primary inbox this also means you won’t get notified of new messages. You can use standard Procmail filtering methods – for instance, if you have a mailing list that always sends mail to the same address, you can do this:

:0: H
* ^To:.*(fspa)
${DEFAULT}.FSPA/

This will match all mail with the string “fspa” in the To: mail address. I’ve found this method of mail management to be extremely helpful and if you have a provider that supports this I hope you are able to take advantage of it as well.

Leave a Reply

Your email address will not be published. Required fields are marked *