LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Procmail (https://www.linuxquestions.org/questions/linux-software-2/procmail-56408/)

PcHammer 04-23-2003 06:33 AM

Procmail
 
Hi all

I just want to ask if anyone have a procmail (or something else) script that would run a program everytime a mail is recived from a specific user.

Regards, PcHammer

unSpawn 04-23-2003 07:33 AM

If you don't mind running it tru a shellscript you could add this to your .procmailrc. This example recipe searches the mailheader for the address you fill in (<user@dom.ain>), dumps the sender address into the REPLYTO variable and supplies it to the shellscript /path/to/doThis.sh.

:0
* ? (formail -x From: | grep <user@dom.ain>)
REPLYTO=`formail -rtzxFrom:`
| sh /path/to/doThis.sh $REPLYTO

Make sure your script tests for not having empty vars, you could even use a case statement to select action based on the address supplied. I use this for mailing back mpacked attachments, remote reporting, stuff like that. Of course you don't need to use a shellscript, you could pipe anything you isolate tru any app that accepts commandline args and doesn't need to run in interactive mode.


All times are GMT -5. The time now is 01:09 PM.