procmail
[Top] [All Lists]

Please help with $MATCH

1997-01-10 18:46:37
I'm having problems with $MATCH.

When I get bounced messages on a list (non-member submissions) I
automatically send some message like "Your non-member message bounced and
maybe I'll pass it on to the list for you if I feel like it...".


The bounced message subject procmail sees looks like this:

Subject: BOUNCE: Non-member submission from [user(_at_)roxy(_dot_)sfo(_dot_)com]

So I (try) to extract the email address from this by:

:0c
* $ ^From $SERVER
* $ !^X-Loop: $LOOP_TEXT
* $ ^Subject: BOUNCE $LIST_NAME: Non-member submission from \[\/.*\]
{
   SENDER="$MATCH"

   (-- rest of recipe sends a message to $SENDER --)


Now, this works *most* of the time, but once in a while the message to
$SENDER bounces back because it picks up the "]" at the end of the email
address in the subject line above:

   ----- The following addresses had delivery problems -----
user(_at_)roxy(_dot_)sfo(_dot_)com]  (unrecoverable error)

   ----- Transcript of session follows -----
550 user(_at_)roxy(_dot_)sfo(_dot_)com](_dot_)(_dot_)(_dot_) Host unknown (Name 
server: roxy.sfo.com].: host
not found)

You can see above how $SENDER ended up with the trailing "]" character.

So, why does this only happen once in a while and is there a better way to
extract this email address from the subject line?

Here is another bounced message that worked fine - I'd guess because of the
difference in the email address (">"), but I don't understand why.

Subject: BOUNCE: Non-member submission from [Ed User 
<eduser(_at_)scs(_dot_)unr(_dot_)edu>]

I guess what I need to know is there a way to END when match loads the
variable (everything between the "[" and "]" ).


Thanks very much.







Bill Moseley
mailto:moseley(_at_)netcom(_dot_)com

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