Loading ...
Sorry, an error occurred while loading the content.

Re: Header checks and variables

Expand Messages
  • Rick Zeman
    ... Interestingly, Ralf, I could adapt yours and get it to do what I wanted, but not mine! (I deleted my changes and below is the totally stock one).
    Message 1 of 4 , Jan 31, 2007
    View Source
    • 0 Attachment
      On 1/31/07, Ralf Hildebrandt <Ralf.Hildebrandt@...> wrote:
      > * Rick Zeman <rzeman@...>:
      > > Hi,
      > >
      > > I'm using header checks to reject certain file extensions with a
      > > bounce that follows:
      > >
      > > Jan 29 18:10:19 mailhub postfix/cleanup[12285]: 2016016B931: reject: header
      > > Content-Type: application/x-zip-compressed;??name="mw070129.zip" from
      > > smtp114.sbc.mail.re2.example.com[123.123.123.123]; from=<joe@...>
      > > to=<me@...> proto=SMTP helo=<smtp114.sbc.mail.re2.example.com>:
      > > 5.7.1 This email has an attachment (.zip, .exe, etc) which was not accepted
      > > by Example. Please resend your mail without it.
      > >
      > > However, some people need to be beaten with a clue by four. Sadly, as
      > > written, that's too generic for some people.
      > > Is there a way (regex?) to take the extension (or better yet, the name
      > > of the file that flunks the test), stuff it into a variable and then
      > > print the contents of the variable within the parentheses above?
      > > If so, this non-scripter doesn't have a clue how so if someone has a
      > > canned example.....:-)
      >
      > /name=\"(.*)\.(386|bat|chm|cpl|cmd|com|do|exe|hta|jse|lnk|msi|ole)\"$/
      > REJECT Unwanted attachment/Unerwuenschter Anhang $1.$2 -- http://webmail.charite.de/doku/faq/#3
      >
      > /name=\"(.*)\.(pif|reg|rm|scr|shb|shm|shs|sys|vbe|vbs|vxd|xl|xsl)\"$/
      > REJECT Unwanted attachment/Unerwuenschter Anhang $1.$2 -- http://webmail.charite.de/doku/faq/#3

      Interestingly, Ralf, I could adapt yours and get it to do what I
      wanted, but not mine! (I deleted my changes and below is the totally
      stock one).

      /name=[^>]*\.(bat|cmd|zip|exe|hta|pif|reg|scr|vb|vbe|vbs|com|lnk|cpl|hlp|wmf
      |msi|msp)['"]*$/ REJECT This email has an attachment which was not accepted by
      Example. Please resend your mail without it.

      Does this make any sense? I know the beginning of the regex differs,
      but that's it.
    Your message has been successfully submitted and would be delivered to recipients shortly.