Postfix provides Mime header check for all incoming messages. You can restrict on .exe / .bat / .vbs files and block all attachments.
mime_header_checks directive allows you to restrict file extension on your mail server.
On most mail server the first thing that needs to be done is to enable header checks and block dangerous files. To block particular file extension attachment in postfix.
Define mime header checks
Open /etc/postfix/main.cf file:
Append mime_header_checks directive as follows:
Save and close the file.
Block attachments
Now open /etc/postfix/mime_header_checks file:
Append following line:
Save and close the file.
Restart postfix
First create postfix lookup table for mime_header_checks file:
You should see rejected mail log in /var/log/maillog file: