Learning procmail

Justin Willmert justin at jdjlab.com
Sat Apr 29 22:41:08 UTC 2006


Paul Michael Reilly wrote:
> Justin Willmert <justin at jdjlab.com> writes:
>
>  > Paul Michael Reilly wrote:
>  > > I have begun the process of learning how to use procmail to filter
>  > > incoming mail messages.  I see that Fedora embeds procmail into the
>  > > sendmail configuration files.  What I would like to do is either find
>  > > some kind of tutorial or some mechanism that I can use to bootstrap my
>  > > knowledge by doing something and seeing some result, most likely in a
>  > > log file (and eventually in a mail buffer).  Any suggestions?
>  > >
>  > > Thanks
>  > >
>  > > -pmr
>  > >
>  > >   
>  > I use procmail to filter this mailing list into its own IMAP folder. If 
>  > you are using IMAP, I'd be happy to send you my configuration files. 
>  > It's a really simple filter and you should get results immediately (due 
>  > to the high traffic volume this list gets).
>
> Certainly.  I am using IMAP and the idea of putting the Fedora messages
> (and others) into their own folders sounds like a winner to me.  
>
> Thanks,
>
> -pmr
>
>   
This is a section of my ~/.procmailrc file:

# Filter Fedora List Messages
:0
* ^TO_fedora-list at redhat.com
.INBOX.fedora-list/

First line is a comment. The second gives parameter information to 
procmail (look in procmail's man page to see the different options 
available. I mostly only ever use :0 though). The next line is the rule 
and says if a mail header begins with a "TO" type header (To, cc, bcc, 
etc.) with fedora-list at redhat.com in the list of addresses, that this 
rule matches (is true). Then the next line is which mail folder it 
should move it to. In this instance, my Dovecot server separates folders 
with a period, so an Inbox subdirectory is INBOX.fedora-list. The 
trailing slash signals that I'm using mail folders and not mail boxes.

I'm not a procmail expert, so if I've gotten any explanation wrong, I'd 
be happy if someone corrected me, but I just know that this works to 
sort my mail.

If you don't already know how to write regex expressions, take the time 
to learn them. I didn't understand them at first, but once I understood 
them, I find myself wishing many more tools let me use regex 
expressions. Procmail uses regex matching rules, so you can 
theoretically create some very complex rules.

Have fun,
Justin




More information about the fedora-list mailing list