On Mon, Mar 06, 2000 at 12:50:38PM -0500, Derek Watson wrote:
> Here's what I'm trying to achieve -
> 
> When an email gets sent to [EMAIL PROTECTED], the message gets processed
> by it's .qmail file, and gets forwarded to a short list of addresses within
> that file.  That works fine, and it was really easy to do.  What I would
> like is to rewrite the subject line of the message before delivery to
> prepend a [maillist] tag before the message.. . so that a message coming in
> like
> ---
> From: [EMAIL PROTECTED]
> Subject: test message
> ---
> gets delivered like
> 
> ---
> From: [EMAIL PROTECTED]
> Subject: [maillist] test message
> ---
> 
> I'm sure you all know what I mean.  I have experimented with "preline". ..
> but I think I'm on the wrong track.  My current .qmail file looks like this:


Do it like this:   (generic script to tag mail included)

.qmail file:
-----
| /usr/local/bin/tagmail.pl "[maillist]" | forward [EMAIL PROTECTED]
-----

tagmail.pl
-----
#!/usr/bin/perl
# tagmail.pl; 1999-02-18; [EMAIL PROTECTED]
use strict;

# read mail and split into hdr and body
my ($hdr, $body);
while (<STDIN>) { last if /^[\r\n]*$/; $hdr .= $_; }
$body = join '',<STDIN>;

# Fix subject-line
$hdr =~ s/^(subject:\s*)(.*)$/$1 $ARGV[0] $2/mi;

# print mail
print "$hdr\n$body";
-------


/magnus

-- 
http://x42.com/

Reply via email to