On Thu, 20 Mar 1997 14:48:08 +0900,
Mitusuru Furukawa <furu(_at_)009(_dot_)com> wrote:
Tim <bodysurf(_at_)pobox(_dot_)com> and
I tried your script
but it seems to fail at the first two lines.
$FORMAIL is apparently supposed to be a variable which should expand
to "formail". Just replace it with formail and you should be OK.
By the way, is FROM=`$FORMAIL -rt -xTo:` correct?
Isn't it FROM=`$FORMAIL -rt -xFrom:`?
The trick here is that the sender could be in Sender: or From: or
Reply-To: or some other place. What formail -rt does is it generates a
reply, but that involves a bit of magic to figure out which of these
should be in the To: field of the new message. Once this is done, you
can get the original sender's preferred reply address by extracting
the To: field from this new message header.
I also tried this version but also failed though.
If I understand your original question correctly, you receive a
message that looks something like this:
From urgent(_at_)urgent(_dot_)com Mon Apr 1 00:00:00 1997 EST
From: urgent(_at_)urgent(_dot_)com
Subject: boy, is this urgent
Date: Mon Apr 1 00:00:00 1997 EST
Please pardon this intrusion of your email privacy ...
And you want to transform that into the following:
From furu(_at_)009(_dot_)com Mon Apr 1 00:00:01 1997 JST
Subject: Forwarding to pager
To: 0399999999(_at_)docomonet(_dot_)or(_dot_)jp
From urgent(_at_)urgent(_dot_)com Mon Apr 1 00:00:00 1997 EST
From: urgent(_at_)urgent(_dot_)com
Subject: boy, is this urgent
Date: Mon Apr 1 00:00:00 1997 EST
Please pardon this intrusion of your email privacy ...
(In fact I suppose you don't want +all+ the headers -- Tim's recipe
will in fact extract only From: and Subject: which I suppose is good
enough for that.)
Try this:
:0 # Want a 'c' here? That would leave a second copy in your inbox
* ^From.*(urgent\.com|important\.com)
* ^Subject:.*(urgent|important)
{
:0fH # Filter original header, leave only Subject and From
| egrep '^(Subject|From):'
:0 # Actually forward to pager
| ( echo "Subject: Forwarding to pager" ; \
echo "To: 0399999999(_at_)docomonet(_dot_)or(_dot_)jp" ; \
echo ; : this empty line is the end of the new header ; \
cat - ; : cat original message, incl. headers ; \
) | $SENDMAIL -oi -t
}
This is not tested but I'm sure the gurus on this list will put an end
to this thread ultimately :-D
Just like $FORMAIL is a variable, so is $SENDMAIL, but I trust you
have that defined already. The sendmail binary is often in strange
places outside of normal folks' PATHs.
/* era */
JST is a fictitious time zone, what is the time zone of Japan? I also
haven't bothered to check what weekday April 1st is going to be, but
the canonical April Fool's day should surely be a Monday.
--
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r. <http://www.iki.fi/~era/>
* Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>