On Mon, 2005-28-02 at 14:24 +0800, Not Zed wrote: > > Well, strictly speaking, it is not entirely incorrect. > > You can still use filters to do that, by using the filers to run a > script which does the forwarding, e.g. via the 'mail' command. > > On Sun, 2005-02-27 at 23:48 -0500, Gangalino wrote: > > You think I would lie about something like this? > > Check your help- 3.6 Create Rules to Automatically Or Organize Mail: > > "For example, your filters could put copies of one message into multiple > > folders, or keep one copy and send one to another person." > > > > Which would be a perfectly normal use of a filter. > > YOUR bug link, however, is untrue. :) > Can you provide me with an example of such a script. Unfortunately, I'm on this GARBARGE BELL/SYMPATICO ISp that filters out any outgoing mail, but I am on a linux machine w/ Postfix/Sendmail, and the address I want to forward to mostly is an alias local to my machine.
At the simplest form, for sendmail or postfix, you add an action:
"Pipe to Program"
and use
/usr/sbin/sendmail -f [EMAIL PROTECTED] [EMAIL PROTECTED]
This will effectively "redirect" or "bounce" the message to "[EMAIL PROTECTED]", and send any errors to "[EMAIL PROTECTED]".
Then you could add other actions to e.g. mark the mail as read or whatever.
If you want to form an attachment of the message it gets a bit trickier, and you need a script. I've attached an example script - it is a little more sophisticated than the trivial-case, as it extracts (multiline) subject to form a destination subject. It could be changed to take the target address from the command line or calculate it from the message.
--- begin script ---
#!/bin/sh
# forwards an rfc822 message from stdin to "to" coming from "from" as a mime attachment
from="not zed <[EMAIL PROTECTED]>"
errors="[EMAIL PROTECTED]"
to="mike <[email protected]>"
msg=~/.forward.$$
date=`date --rfc-2822`
# save message
cat - >$msg
# generate forwarded subject
subject=`cat $msg | sed -e "/^$/ q" -e "/^Subject:/ s/Subject:/Subject: Fw:/" -e "/^Subject:/,/^[\t ]/ p" -e "d" -e "/^$/ q"`
# build/send message
( echo "From: $from"
echo "To: $to"
echo "$subject"
echo "Date: $date"
echo "Mime-Version: 1.0"
echo "Content-Type: message/rfc822"
echo ""
cat $msg ) | /usr/sbin/sendmail -f $errors $to
rm $msg
