procmail
[Top] [All Lists]

Re: Check & Do

1997-12-18 15:05:40
On Thu, 18 Dec 97 18:05:24 -0000, Palotas Peter
<sysman(_at_)starkingnet(_dot_)hu> wrote:
:0c
| ( formail -XFrom: -XSubject: ; echo ; echo "You have new mail!" ) \
| $SENDMAIL $SENDMAILFLAGS 
NitificationAddress8(_at_)mobile(_dot_)phone(_dot_)com
Can I send the mail to different  NitificationAddresses depending on the 
From or other fileds of the incoming mail?
If From is A then send to Notification1
If From is B then send to Notification2
If From is C then send to Notification3

Of course you can. The hard part is answering "how can I easily ...". 

First idea: put together a Makefile to generate n recipes from a file
of n From -> notification records.

Secord, actually less optimal, idea: Read the file dynamically from
within your Procmail recipe. 

FROM=`formail -rzxTo:` # or whatever
NOTIF=`sed -n "/^$FROM  /s///p" notif.txt`
:0c
* NOTIF ?? [^   ]
| ( formail -XFrom: -XSubject: ; echo ; echo 'You have new mail!' ) \
    $SENDMAIL $SENDMAILFLAGS "$NOTIF"

The file notif.txt would contain e-mail addresses and notification
addresses separated by a tab. (The whitespace after $FROM is a single
tab.) 

More advanced database engines than this sed script could certainly be
imagined.

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

<Prev in Thread] Current Thread [Next in Thread>
  • Check & Do, Palotas Peter
    • Re: Check & Do, era eriksson <=