Procmail

From Support

Jump to: navigation, search

This page is a Tutorial. This is intended to teach how to use a program or service. Improvements are encouraged, but substantial changes should be vetted.

Procmail is a program for sorting email. It follows the instructions in your .procmailrc to put mail into different folders, forward email or even just delete it without a trace.

Contents

Initial Setup

On Spoon your .procmailrc will look something like this:

#Default .procmailrc - foward mail to TCD address
#Put a # in front of both lines below for local mail delivery
:0
! username@tcd.ie

This sends all your email to your Trinity address - after removing viruses and spam. Note that by default your spam will end up in ~/Maildir/Junkmail/

Filtering based on who an email is from

Lets start out by putting all your email from people in Netsoc in a seperate folder. Replace your .procmailrc with:

:0
* ^From: .*@netsoc.tcd.ie
.netsoc/

Note that everything else will now end up in ~/Maildir. The .netsoc folder doesn't exist, but procmail will create it the next time someone from Netsoc emails you.

Once that happens you can type mutty to view your email. Alternatively if you're using IMAPS, your email client should show the new folder.

The .* in the above means anything. Procmail uses Regular Expressions to classify email.

Mailing Lists

If you were on ILUG (the Irish Linux Users' Group) and wanted your email in a separate folder you could use:

:0
* ^List-Id: .*ilug.linux.ie
.ilug/

You'll have to go through the headers of an email from your mailing list to find one that will separate it from other email.
A more thorough tutorial on Procmail recipes can be found here.

See Also

Personal tools