procmail
[Top] [All Lists]

RE: Piping a message to a script, but it doesn't run

2009-03-27 17:55:20
Michael Bluejay wrote Thursday, March 26, 2009 21:33:


I didn't know about $MATCH.  I'm content to use that if it
solves my problem, but I can't my recipe to match the address,
as I'll explain.

I figured out how to get Sendmail to set the
Return-Path: header, so I'm injecting the subscriber's email
address into it when I send out a mailing list message like so:


      bounces+user-at-example(_dot_)com(_at_)example(_dot_)com

I'm trying to extract the relevant bit (user-at-example.com) 
from the  
bounce message with this pattern:

      * ^To:.*bounces\+\/.+!(@example.com)

But my .procmail logfile says "No match" on that pattern.

What's wrong with my recipe?

The last syntax with the bang is not a standard regex.

Try:

   :0:
   * ^To:[^+]+[+]\/.*@
   * MATCH ?? ^^\/(_dot_)*[^(_at_)]
   /path/to/$MATCH

Or do you literally write "-at-" instead of "@" in the conversion
you do in sendmail?  If so, you could change it back in procmail
or with a simple pipe to sed, which is a bit easier:

   :0:
   * ^To:[^+]+[+]\/[^(_at_)]+
   /path/to/`echo $MATCH | sed 's/-at-/@/'`
   

Or an all-procmail way:

   :0
   * ^To:[^+]+[+]\/[^(_at_)]+
   {
      REPLYTO = $MATCH

      :0
      * REPLYTO ?? ^^\/.*-at-
      * MATCH   ?? ^^\/.*[^a]
      * MATCH   ?? ^^\/.*[^-]
      { } LOCALPART = $MATCH

      :0:
      * REPLYTO ?? -at-\/.*
      /path/to/$LOCALPART(_at_)$MATCH
   }

That is untested, but I think it will work.

Dallman

____________________________________________________________
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