procmail
[Top] [All Lists]

Re: Capturing from address and running a program

2006-10-31 11:44:46
On Mon, 30 Oct 2006 14:53:14 -0500, Matt Dunford wrote:
On 10/25/06, Poohba <poohba(_at_)blkpoohba(_dot_)dyndns(_dot_)org> wrote:
I need to get the from address and use it in a program.  I have a script
that I want to run depending on the subject.  I am going to send out an
email and the replies will run a program and the program is suppose to
send an email back to them but I need to get the email address to do
this.  Also.  Does procmail allow you to run a command with arguments?
ie:

:0:
* ^Subject.*this is a test for this program
|/path/to/this/program/for senders_email_address

So how do I get the email address and would that work?  The program will
take that argument and plug it in as the recipient.

Try something like this (not 100% sure on the regex):

:0:
* ^From:.*\/[0-9a-z(_dot_)_-]+(_at_)[0-9a-z(_dot_)_-]+\(_dot_)[a-z]+
* ^Subject.*this is a test for this program
|/path/to/this/program/for "$MATCH"

You can use formail to give you the email addy that a "Reply" would be 
sent to:
         formail -rtzxTo: 

I use this approach to compare the 'From' of an email to my whitelist:
 :
 |WHITE = "No"
 |:0
 | * ? formail -rtzxTo: | fgrep -i -f $PMDIR/whitelist
 | {
 |  WHITE = "Yes"
 | }
 :

HTH
Jonesy
-- 
  Marvin L Jones    | jonz          | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
    *** Killfiling google posts: <http//jonz.net/ng.htm>


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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