IC Home > Know-how > Linux > Sendmail > Procmail > Reto's Procmail Recipes > Procmail

3 Reto's Procmail Recipes


2.3 procmailrc [  up  ] - [ Top of Procmail ] 3.1 Special Recipes
3.1   Special Recipes
 3.1.1  Examples
 3.1.2  Examples 2
3.2   Autoresponder

  1. Forward a copy of the e-mail if the subject begins with a specific pattern
    :0c
    * ^Subject: AW: \[TEST\] *
    ! foo@example.org


  2. Move as SPAM tagged e-mails into a directory, then delete the e-mail
    :0
    * ^Subject: \[SPAM\] *
    {
      :0c
      /home/retoh/SPAM
    
      :0
      /dev/null
    }


  3. Is there a procmail recipe to move a message into an IMAP folder?
    First of all, define a variable in /etc/procmailrc, e.g. you had an IMAP folder «DailyReport»:

    IMAP_DailyReport=$HOME/Maildir/.DailyReport/

    Please note the dot (".") before the IMAP folder name is important and not a typer. Then, add this rule to your .procmailrc in your home directory:
    :0
    * ^Subject: Report: *
    ${IMAP_DailyReport}

    If an e-mail's subject begins with "Report: " it will be stored straight into the IMAP folder DailyReport instead of your Inbox.

  4. I want to put SPAM mails into a dedicated folder server-side and by-pass the Inbox
    :0
    * ^Subject: \[SPAM\] *
    ${IMAP_SPAM}

    (You have to define the related variable in /etc/procmailrc)
    Of course, you have to put this recipe *after* the spamassasin filter recipe which might look as followed
    :0fw: spamassassin.lock
    | /usr/bin/spamassassin


  5. Move large messages directly to special folder
    # messages of size greater than 1 MB are too large for my inbox
    : 0
    * > 1000000
    ${IMAP_LARGE}


  6. Use a logical AND while filtering
    Move all messages with a sender beginning with "top<anything>@<anything>" AND a subject containing «Frottier» to the SPAM folder.
    :0 H
    * ^From: [a-z]* ?<?top.*@*
    {
            :0 H
            * ^Subject: .*Frottier.*
            ${IMAP_SPAM}
    }


[ Procmail ] - [ 3.1 Special Recipes ]



copyright by retoh - created with mytexi
$Id: procmail.mtxi,v 1.21 2007/04/06 07:44:08 webcms Exp $