Blocking .exe attachments with postfix or amavisd-new and ISPConfig 3

If you use postfix and / or amavisd-new on the mail server, you can use the following recipes to block emails with executable (exe, bat, scr) attachments.

Block the attachments with a postfix header filter

In ISPConfig, click on "Email in the upper menu, then on "Content filter" in the left menu and click on the "Add new content filter" button. Enter the following details:


MIME-Header Filter

Regexp. Pattern:



File extension is blacklisted on this server



Use amavisd-new to block the emails with executable attachments.

Edit the amavisd configuration file (/etc/amavisd.conf or /etc/amavisd/amavisd.conf)

vi /etc/amavisd/amavisd.conf

and add the following lines:

$banned_filename_re = new_RE(

then restart amavisd-new:

/etc/init.d/amavis restart


3 thoughts on “Blocking .exe attachments with postfix or amavisd-new and ISPConfig 3”

  1. Hi, Is it really a file type blocking or only a file extension one?
    I mean in both postfix and amavis-new…


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>