.promailrc help

jdow jdow at earthlink.net
Fri Jul 7 21:05:17 UTC 2006


From: "Paul Howarth" <paul at city-fan.org>

> Phil wrote:
>> I have procmail installed and working with fetchmail.
>> There is only one problem...
>> 
>> If I have more than one email in the To: or CC: fileds and both these email
>> addrresses are supposed to go to two different folders... they do not...
>> both email go to the same folder...
>> 
>> How do I setup .procmailrc so that it parses the entire To: or CC: fileds
>> first before moving them to a directory?
>> 
>> In the example below if an email has both support and user1 in CC: or To:
>> fileds I will get two emails in the support directory....however if 
>> there is
>> only one email address in the To: or CC: fileds the emails will go to the
>> appropriate directory... any help would be great.
>> 
>> Here is my .procmailrc file
>> 
>> MAILDIR=$HOME/mail
>> 
>> LOGFILE=/var/log/procmail.log
>> #VERBOSE=yes
>> 
>> :0
>> * ^From:.*postmaster at fakeemail.com*
>> /dev/null
>> 
>> :0
>> * ^TOsupport@
>> $MAILDIR/support
>> 
>> :0
>> * ^TOuser1@
>> $MAILDIR/friends
> 
> Both of these last two recipes are "delivering" recipes, which means 
> that procmail stops processing the mail when it matches one of them.
> 
> What you could do would be to add the "c" flag to each recipe (":0 c"), 
> which would mean that the mail was copied for the purposes of those 
> recipes and processing would continue even if either or both of those 
> were matched.
> 
> Of course, you would then find that mail for either or both of these 
> addresses went on to be processed by any further recipes in your 
> procmailrc (so it would get delivered to the default mailbox as well by 
> default). You'd need to add another recipe to prevent that if that's not 
> what you wanted.

You could try something like this. It should do what you want.
===8<---
MAILDIR=$HOME/mail

LOGFILE=/var/log/procmail.log
#VERBOSE=yes

:0
* ^From:.*postmaster at fakeemail.com*
/dev/null

# Is it to both support@ and user1@
:0
* ^TOsupport@
* ^TOuser1@
{
    # copy and deliver to support
    :0 c
    $MAILDIR/support

    # final delivery to friends.
    :0
    $MAILDIR/friends
}

# Process single addresses.
:0
* ^TOsupport@
$MAILDIR/support

:0
* ^TOuser1@
$MAILDIR/friends

# Presumably somewhere down here you have a final delivery address if
# you want it somewhere other than the default.
===8<---



{^_^}




More information about the users mailing list