At 09:09 AM 2/5/2002, Matt Dunford wrote:
Here's how you strip headers. (untested)
:0hfw
| formail -IX-MS-Has-Attach: -IX-MS-TNEF-Correlator: -Ianother-header:
Thanks - it worked like a charm!
Here are the very slightly modified results
(for others to benefit from),
John
STEP 1: Add this one line to your $HOME/.procmailrc file:
INCLUDERC=$PMDIR/rc.headers # Remove extraneous Microsoft Exchange headers
STEP 2: Put this two-line recipe in your $HOME/.procmail/rc.headers file:
############################################################################
# Recipe Name: rc.headers
# Recipe Author: Matt Dunford <zoot(_at_)zoticos(_dot_)com>
# Recipe Purpose: Eliminate Microsoft-Exchange extraneous email headers
# Original Version: 1.00 Wed Jul 17 19:54:27 PDT 2002
# Current Revision: 1.00 (experimental)
############################################################################
# Typical Microsoft Exchange headers might look something like:
# Thread-Index: AcIt6X0iMQBEfvlNRq2iG2k15bBhCg==
# Thread-Topic: What products are in the new Bundles?
# X-MS-Has-Attach: yes
# X-MS-TNEF-Correlator:
# X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3
# X-MIME-Autoconverted: from quoted printable to 8bit by machine id 1234
# These headers are all apparently USELESS to mail user agents such as
# Eudora, Zmail, Pine, Mush, Netscape, etc. These extraneous headers clutter
# forwarded replies; and they have to be edited out manually w/o this neat
# filter (by those courteous enough to edit garbage out when forwarding
# Microsoft Exchange messages to users).
############################################################################
# Note: Do not eliminate these two headers (or you won't see attachments):
# Content-Type: multipart/mixed;
# MIME-Version: 1.0
############################################################################
# Don't be fooled by Sun 'headers'; typical Sun mailtool BODY lines look like:
# X-Sun-Charset: us-ascii
# X-Sun-Content-Lines: 141
# X-Sun-Data-Description: text
# X-Sun-Data-Name: text
# X-Sun-Data-Type: text
# But, since these are in the email BODY; this header filter ignores them.
# QUESTION: How does formail strip lines out of the BODY of the email?
############################################################################
# Instead of specifying the headers at the formail prompt, e.g.:
# formail -IThread-Index: -IThread-Topic: -IX-MS-Has-Attach:
# Specify the headers using easy-to-maintain variables:
HEADER1=Thread-Index:
HEADER2=Thread-Topic:
HEADER3=X-MS-Has-Attach:
HEADER4=X-MS-TNEF-Correlator:
HEADER5=X-MimeOLE:
HEADER6=X-MIME-Autoconverted:
############################################################################
:0hfw
| formail -I$HEADER1 -I$HEADER2 -I$HEADER3 -I$HEADER4 -I$HEADER5 -I$HEADER6
############################################################################
# This simple two-line recipe roughly performs the following tasks:
# :0 ===> begin a recipe
# h ===> feed just the header to the action line (not the body)
# f ===> consider the pipe as a filter
# w ===> wait for the filter to finish & check its exitcode
# ===> there are no conditions, so process every incoming email
# | ===> action is to run the specified UNIX (filter) program
# formail ===> run the formail filter program
# -I ===> delete (or insert) the specified field (see "formail -help")
############################################################################
# End of: rc.headers
############################################################################
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail