procmail
[Top] [All Lists]

Re: procmail friends list

1996-07-10 22:06:04
John Conover writes:
Is it possible to have procmail look at a file or list of email
addresses, and if an address appears in the list it files the message
in a mailbox, else it files it in the default mailbox?  I know the
names can be put in ~/.procmailrc, but it would be more convenient if
the names were stored in a separate file from a maintenance
standpoint, (maybe even ~/.mailrc, or ~/.elm/aliases.text.) Maybe
something like the cache used in Smartlist, or something. Do I have to
spawn an egrep to do this?


Here is what I came up with-uses egrep, though:

# Handle any remaining message from someone that mail is expected from.
# This is done by extracting the address of the message's sender, and
# checking if a like address is in the user's ~/.mailrc file. If the
# mail is from someone that mail is expected from, file the mail in the
# user's home mail box. Start by getting the best return address without
# names or comments-nothing needs to be escaped since the search will
# be done by fgrep(1) which treats its search argument as a string
# literal-the -i argument will be specified to ignore search case.

SENDER=`formail -rtzx To:`

# Next, test for the existence of a ~/.mailrc file, and if it exists,
# then search ~/.mailrc for the return address-if found, file the
# message in the user's home mailbox.

:0 h
* ? test -f ~/.mailrc
* ? fgrep -i -s "$SENDER" ~/.mailrc
{
    :0:
    mymailbox
}

        John
        
-- 

John Conover, 631 Lamont Ct., Campbell, CA., 95008, USA.
VOX 408.370.2688, FAX 408.379.9602
john(_at_)johncon(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>