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 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


* ^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 <>
ReSent-Subject: pain is killing your sister
ReSent-Message-ID: <>
 ^TO_.* * < 256000

 . { :0fw: spamassassin.spamlock
 | sed -e '/^ReSent-/ d' :0c: spamassassin.spamlock | sa-learn --spam :0: spamassassin.filelock spam }

Tip for mail server admins

Create Spam and NoSpam mailfolders for your users.

Now all people need to do if something is not spam,.. pull the mail from the Spam to the NotSpam Folder They now also have the ability to pull mail that is spam but not classified as such to the Spam folder. Just need to run the Ham/Spam learner on a regular base to keep the bayes listings up to date. And run a cronjob to remove all spam older than X days. Where X ofcourse has to be determined within your organization. ( PeterDrenth )


Thanks to WilliamStearns for the original redirection info used on this page.