What's in your .procmailrc [closed]
Asked Answered
T

4

6

Are there any handy general items you put in your .procmailrc file?

Tears answered 12/8, 2008 at 5:24 Comment(0)
A
5

Many mailers prefix a mail's subject with "Re: " when replying, if that prefix isn't already there. German Outlook instead prefixes with "AW: " (for "AntWort") if that prefix isn't already there. Unfortunately, these two behaviours clash, resulting in mail subjects like "Re: AW: Re: AW: Re: AW: Re: AW: Lunch". So I now have:

:0f
* ^Subject: (Antwort|AW):
|sed -r -e '1,/^$/s/^(Subject: )(((Antwort: )|(Re: )|(AW: ))+)(.*)/\1Re: \7\nX-Orig-Subject: \2\7/'

Which curtails these (and an "Antwort: " prefix that I've evidently also been bothered by at some point) down to a single "Re: ".

Airlia answered 18/8, 2008 at 23:15 Comment(0)
V
5

Just simple things - move messages to appropriate folders, forward some stuff to an email2sms address, move spam to spam folder. One thing I'm kind of proud of is how to mark your spam as "read" (this is for Courier IMAP and Maildir, where "read" means "move to different folder and change the filename"):

:0                                                                              
* ^X-Spam                       # the header our filter inserts for spam                                                                   
{                                                                               
    :0                                                                         
    .Junk\ E-mail/              # stores in .Junk E-mail/new/                                                                                      

    :0                                                                          
    * LASTFOLDER ?? /\/[^/]+$   # get the stored message's filename                                                   
    { tail=$MATCH }             # and put it into $tail
    # now move the message                                                            
    TRAP="mv .Junk\ E-mail/new/$tail .Junk\ E-mail/cur/$tail:2,S"               
}
Vitelline answered 12/8, 2008 at 9:21 Comment(0)
A
5

Many mailers prefix a mail's subject with "Re: " when replying, if that prefix isn't already there. German Outlook instead prefixes with "AW: " (for "AntWort") if that prefix isn't already there. Unfortunately, these two behaviours clash, resulting in mail subjects like "Re: AW: Re: AW: Re: AW: Re: AW: Lunch". So I now have:

:0f
* ^Subject: (Antwort|AW):
|sed -r -e '1,/^$/s/^(Subject: )(((Antwort: )|(Re: )|(AW: ))+)(.*)/\1Re: \7\nX-Orig-Subject: \2\7/'

Which curtails these (and an "Antwort: " prefix that I've evidently also been bothered by at some point) down to a single "Re: ".

Airlia answered 18/8, 2008 at 23:15 Comment(0)
D
3

I have various filters in my .procmailrc file, but the most useful is this one, which I add to the very top of the file before I make any other changes.

:0 c:
mail.save

This saves a copy of everything and then continues with the rest of the recipes. If I've done something wrong, my e-mail is saved in the file "mail.save". When I'm sure my changes are working, I comment these lines out, until the next time.

Drice answered 12/9, 2008 at 3:0 Comment(0)
F
2

To stop weird russian and chinese spams, I use this procmail configuration.

UNREADABLE='[^?"]*big5|iso-2022-jp|ISO-2022-KR|euc-kr|gb2312|ks_c_5601-1987'
:0:
* ^Content-Type:.*multipart
* B ?? $ ^Content-Type:.*^?.*charset="?($UNREADABLE)
spam-unreadable
Fragmentation answered 30/8, 2008 at 19:47 Comment(1)
As much as I like all the answers, this one I found particularly useful. Also this is probably my first question from when SO was beta, so I apologize for asking a "not-one-answer" question.Tears

© 2022 - 2024 — McMap. All rights reserved.