procmail
[Top] [All Lists]

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

2009-03-25 22:04:42
On Thu, Mar 26, 2009 at 02:18:30AM +0100, Holger Wahlen wrote:

* Dallman Ross wrote:

[The OP wrote:]
In fact, I would be happy to bypass my script altogether, if
I could get procmail to just save the file somewhere with the
Reply-To address as the filename, but I couldn't figure out
how to do that either.

In the brackets below are a caret, a space, and a tab.

   :0:
   * ^Reply-To:.*\/[^       ].*
   /path/to/$MATCH

That's ok if there's just

  Reply-To: someone(_at_)example(_dot_)com

but not for

  Reply-To: Some Person <someone(_at_)example(_dot_)com>

(assuming that only the address itself is supposed to be the file name),
or is it?

Ah.  Good point.  I was thinking of something like Delivered-To:,
which on my system always has only an email address after one space
char.  Actually, looking in some recent good mail of mine, the
only Reply-To: fields I find have an address and, usually, <surround-
brackets>, but no Gecos name or other text.  But though I haven't
looked at the RFCs, I suspect a Gecos name there is OK.

Well, if he want's to save the whole line, what I wrote will still
work, but only if $MATCH is put in quotation marks.

   /path/to/"$MATCH"

The file will have whitespace in it, then.

If he really wants only the address part, here are two ways:

   REPLYTO = `formail -I From -I Return-Path -rt -zcx To`

   :0:
   * ^Reply-To:
   /path/to/"$REPLYTO"

(Don't bother if there was not Reply-To: field.)

or

   SPACE = ' '
   TAB   = '    '
   WS    = $SPACE$TAB

   :0
   * $ ^Reply-To:.*\/[^$WS<([]+(_at_)[a-z0-9_-]+[(_dot_)][a-z]+
   /path/to/"$MATCH"


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