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.
- AOL's integrated email client: Redirecting mail is not available. (Dave Goldsmith)
- Apple Mail: Select the message, go to the "Message" menu, choose redirect, fill in the address, and choose send. (KarstenDambekalns)
- Eudora: Select the message, go to the "Message" menu, choose redirect, fill in the address, and choose send. (BrianCorcoran and ErikWheeler)
- Evolution: Select the message. In the "Actions" menu, choose the "Forward" submenu (not "Forward message", the "Forward" submenu). Pick "Redirect", fill in the "To" field, and press "Send". (JohannesUllrich)
- Novell GroupWise: Note the current (as of this writing) version of GroupWise is v6.5. In general, the stock GroupWise client can't "bounce" a message, because the message has been converted to the internal GroupWise format (i.e. no longer in SMTP format). One workaround would be to write a GroupWise C3PO (Custom 3rd-Party Object - see http://developer.novell.com/ndk/gwc3po.htm) to add this functionality to the client. Using the stock client, to pass a SPAM (or HAM) message along to a collection point, use Forward as Attachment to send it from GroupWise (select the message, Actions menu, Forward as Attachment; type in the address and click on Send). At the receiving end, you'll need a Procmail recipe (or similar tool) to delete the headers down to the string "message/rfc822" plus the blank line after it. All the header info is preserved by GroupWise (through the hidden "system attachment" Mime.822). Note that older, unsupported versions of GroupWise either don't support IMAP (v5.2 and earlier) or don't support it well (v5.5/v5.5EP); this support is much-improved in v6.5. Finally, the GroupWise system includes a Trusted Application API (see http://developer.novell.com/ndk/gwtapp.htm) with which you could implement a more-direct connection to SA. Here is an example .procmailrc I use for user "spam" (please note it's my first and only ever effort at these things!):
# /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)
- KMail: In recent versions of KMail (1.6 and later) you need to copy the message first to your "sent-mail" folder. Then choose the command "Send again..." from the menu "Message". (MalteStretz)
- Lotus Notes: Does not seem to have a method to resend messages. (DennisHennen)
- We may have found a way around this: We created buttons for spam and ham false positives, to copy them to specific mail folders. Then we fetch the contents of these folders with Mozilla mail and voilà, they are mbox format again, ready to be submitted to SA. (JoSimoens)
- Microsoft Outlook 97: Double-click on the message so it opens in a new window. Click on Tools-Resend This Message. A warning will appear about you not being the original sender of the message. Click Yes. A message window appears. Update the To: field and click on 'Send'. (DaveGoldsmith)
- Microsoft Outlook 2000 & higher: Double-click on the message so it opens in a new window. Click on Actions->Resend This Message. A warning will appear about you not being the original sender of the message. Click Yes. A message window appears. Update the To: field and click on 'Send'. (DaveGoldsmith)
- Microsoft Outlook Express: It does not appear to have a redirect option. (DaveGoldsmith and AlexBates)
- Mutt: Select the message and use the bounce command by pressing lowercase 'b'.
- Netscape Communicator 4.x and 7.x: They don't appear to have a redirect option.
- OS/X Mail.app: With the email message open or selected, go to Mail's 'Message' menu and select 'Bounce to sender' or 'Redirect'. If you use this frequently, go to the "View" menu, choose "Customize toolbar", and add a button for "Redirect". (MarionBates)
- Pegasus Mail: Click onto Forward and select "Forward the messages without editing (redirect, or bounce)" (JosefRadinger)
- Pine: For a single message, highlight the message and press "b" to bounce it. Enter the target address and press enter. For multiple messages, select all the messages you'd like to bounce with either ":" to select them one at a time, or ";" to select multiple messages by message number, subject, body text, etc. Once selected, press "a", then "b" to Apply the Bounce command to all of them. Enter the target email address. Once done, press ";", then "a" to Unselect All selected messages. More can be found at: http://www.itc.virginia.edu/desktop/email/pine/bounce.html Bouncing with Pine to my PlussedEmail address adds several headers that I strip off with procmail and sed:
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 }
- SquirrelMail: You'll want to use the "Spam Buttons" plugin, located at http://squirrelmail.org/plugin_view.php?id=242.
- Sylpheed: Click on the message, go to the "Message" menu, choose "Redirect", fill in the "To:" address, and press send. Alternately, right click in the message and choose "Redirect" from the popup menu, fill in the "To:" address, and press send. (DaveGoldsmith)
- Mozilla Thunderbird: As of version 0.8+ the Redirect functionality is missing, but you can add it by installing the redirect extension. (MatiasPelenur)
From the Linux/Unix command line: If you have a folder in mbox format, you can resend each message to one or more new destinations with the following command:
formail +1 -i "To: spamarchive@mycompany.com, uce@ftc.gov" -i Cc: -f -ds /usr/sbin/sendmail -t -oi </path/to/folder
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 )
Contributors
Thanks to WilliamStearns for the original redirection info used on this page.
- AlexBates
- BrianCorcoran
- DanKohn
- ErikWheeler
- JohannesUllrich
- MarionBates
- DennisHennen
- JosefRadinger
- PsiCop
- JonGerdes
- PeterDrenth