Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Non-Environment variables in procmail?? 1

Status
Not open for further replies.

RottPaws

Programmer
Mar 1, 2002
478
US
Is it possible to set and use a variable in a procmail recipe?

What I'd like to do is search for an x-header and if it's there, then forward a copy of the email to the email address in that header.

Something like . . .
Code:
:0
* ^X-ForwardTo: (captuerThisAddress@sumware.com)
{
  :0 c
  ! FORWARDTO

  :0
  | /scripts/handler.pl
}

_________
Rott Paws

...It's not a bug. It's an undocumented feature!!!
 
This is untested:

:0
* ^X-ForwardTo: \/[^ ]+
{
:0 c
! $MATCH

:0
| /scripts/handler.pl
}

From 'man procmailrc':
MATCH This variable is assigned to by procmail whenever it is
told to extract text from a matching regular expression.
It will contain all text matching the regular expression
past the `\/' token.
and
\/ Splits the expression in two parts. Everything matching the
right part will be assigned to the MATCH environment variable.
 
That worked like a charm. I searched for variable, string, scalar, and everything else I could think of, but MATCH never occurred to me.

Thanks! [thumbsup]

_________
Rott Paws

...It's not a bug. It's an undocumented feature!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top