Resending a mail message while preserving the headers

Here's how to redirect (or "bounce") a mail message to another recipient. This is important when training Bayes via mail (as described in ProcmailToForwardMail), for example. It's often critical to redirect the message, rather than forwarding. Forwarding loses all of the critical header information, which is much of what Bayes trains from. Here are directions for redirecting from different clients. Note that for all redirections, you'll want to clear away all To: and Cc: entries and then add spam@example.com to the To:, in order to avoid resending the spam to another victim.

# /home/spam/.procmailrc

# GroupWise forwarded mail, subject starts Fwd:
#     Strip off the forwarding mail, leaving the attachment
#     Remove the leading blank line

VERBOSE=on
DEFAULT=$HOME/Maildir/
LOGFILE=$HOME/procmail.log

:0
* ^Subject: Fwd:
{
    :0fw: splitmsg.lck
    | sed -e '1,/message\/rfc822/d'

    :0fw: splitmsg.lck
    | sed -e '1d'
}

(JonGerdes & PsiCop)

ReSent-Date: Wed, 27 Oct 2004 10:50:57 -0500 (CDT)
ReSent-From: User Name <username@company.com>
ReSent-To: username+spam@company.com
ReSent-Subject: pain is killing your sister
ReSent-Message-ID: <Pine.LNX.4.58.0410271050570.29000@company.com>

.procmailrc stanza:

 ^TO_.*spam@company.com
* < 256000

   {
   :0fw: spamassassin.spamlock
   | sed -e '/^ReSent-/ d'

   :0c: spamassassin.spamlock
   | sa-learn --spam

   :0: spamassassin.filelock
   spam
   }

Contributors

Thanks to [WilliamStearns] for the original \[http://www.stearns.org/doc/spamassassin-setup.current.html<ac:structured-macro ac:name="redirect" ac:schema-version="1" ac:macro-id="32964308-6c4b-4eeb-b459-d3562de81a63"><ac:parameter ac:name=""><ac:link><ri:page ri:content-title="redirection info] used on this page." /></ac:link></ac:parameter><ac:parameter ac:name="location"><ac:link><ri:page ri:content-title="redirection info] used on this page." /></ac:link></ac:parameter></ac:structured-macro>


CategoryBayes