Re: List the recepient of the message in -LITemplate- ?

1999-07-01 15:41:56
On July 1, 1999 at 09:31, "Simeon ben Nevel" wrote:

Peter Hrobar said:
--> I'm using the MHonArc standard input to receive messages from qmail
(via a .qmail file). Is there any tool which can copy ( or merge ) the TO:
field of the message to the SUBJECT field on the fly ?

You can use a combination of procmail (to intercept the message) and 
formail (part of the procmail package) to manipulate the headers.

As part of the process you can use procmail to deliver the message to 
MHonArc.  There's LOADS of procmail/formail information on the net...

This is probably the cleanest solution.

The alternative is to modify the MHonArc source to insert the to: field
value into the subject.  Or, *WARNING* *HACK* *HACK*, you can use
the SUBJECTSTRIPCODE to do this if you take advantage of some MHonArc
internals.  When SUBJECTSTRIPCODE is evaluated, you should be able
to access the parsed message header by access the %fields hash.


## Grab To: field.  We assume only one To: field defined in message.
my $to = $fields{'to'};

## Grab "human" name (use extract_email_address if you want address).
## This assumes only a single receipient in To: field.  If not, a more
## complex extraction may be required.
my $name = extract_email_name($to);

## Set Subject that MHonArc will use.  We just prepend name.
$_ = "$name: $_";


This is untested, so user beware.


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