How to Remove X-headers

Glenn Steen glenn.steen at
Thu Mar 12 08:35:10 GMT 2009

2009/3/11 Alex Broens <ms-list at>:
> On 3/11/2009 10:50 PM, Glenn wrote:
>> We use MailScanner and Postfix on a mail gateway server and forward mail
>> to an internal Microsoft Exchange 2003 server.  Evidently, enough X-headers
>> have accumulated in an Exchange database to cause a problem, so we need to
>> remove X-headers before they are forwarded to the Exchange server.
>> There is a line in MailScanner.conf that allows us to name whatever
>> headers we want to remove ("Remove These Headers"), but this raises some
>> questions.  If we just blanket remove all X-headers, won't this defeat
>> features of MailScanner that depend on MailScanner adding headers?
>> According to hints in the MailScanner rules directory, we should be able
>> to use regular Perl expresssions to create a ruleset to exclude certain
>> headers from the delete list.  My problem is that I don't have a clue how to
>> write regular Perl expressions.  From what I've read online, for example,
>> the lines below should be equivalent, but when I use the Perl expression in
>> the ruleset it doesn't work.
>> From:  [ipaddress]  X-MimeOLE:    ##this removes the X-MimeOLE header
>> From:  [ipaddress]  /^XMime.*\:/  ##this doesn't
>> I know this isn't a Perl forum, but I'm hoping that someone who has tried
>> this can enlighten me.  If I could just get a simple expression to work, I
>> might be able to build what I need.  Thanks.   -Glenn.
> Before you start breaking MIME headers, who told you this or what MS KB
> article covers this?
Apart from that... this would be the job of PF, IMO... Just a header
check with an IGNORE... Something like:
/^X-MimeOLE:/                                  IGNORE  # This drops
the MIME type header
... would work nicely.

But do as Kai tells you, think carefully on what the ramifications of
any such exclusion would be before implementing!
There are quite a few examples of headers to remove on various
postfix-related sites... Google and take your pick:-)

-- Glenn
email: glenn < dot > steen < at > gmail < dot > com
work: glenn < dot > steen < at > ap1 < dot > se

More information about the MailScanner mailing list