Ok thanks, I'm not sure I completely understand the syntax of the perl reg ex.

Do you know why even testing the example I was sent through this user list it 
still applies the reg ex to other mime headers? I understood that this 
expression was tested in production by users but when I look in my mail log I 
still see the check being applied to other mime headers. Is this something to 
do with the negative matching aspect?

Paul
-----Original Message-----
From: owner-postfix-us...@postfix.org [mailto:owner-postfix-us...@postfix.org] 
On Behalf Of Wietse Venema
Sent: 08 June 2010 13:16
To: Postfix users
Subject: Re: Setting mime-header checking

Ockleford Paul (NHS Connecting for Health):
> Hi,
>
> Hopefully someone on this list can help me out. I am trying to
> set up mime-header checking to only allow through emails with a
> particular file extension, that is I want to block any email
> without this attachment type or any other attachment type.

First, you need to ensure that the rule is applied only to
Content-Type/Disposition headers and not to other MIME headers.

Second, negative matching can be tricky. It may be easier to
eliminate the good cases first, as shown below.

Untested PCRE example:

if /^Content-(Disposition|Type):/
/name\s*=\s*"?(.*(\.|=2E)(aaa|bbb))(\?=)?"?\s*(;|$)/x DUNNO
/./ REJECT Attachment name must end in ".aaa" or ".bbb"
endif

        Wietse


********************************************************************************************************************

This message may contain confidential information. If you are not the intended 
recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take 
any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff 
in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information 
with NHSmail and GSI recipients
NHSmail provides an email address for your career in the NHS and can be 
accessed anywhere
For more information and to find out how you can switch, visit 
www.connectingforhealth.nhs.uk/nhsmail

********************************************************************************************************************

Reply via email to