4.8. Blocking certain attachments

To block certain extensions of attachments (.exe, .bat, …) edit /etc/postfix/main.cf and add

mime_header_checks = regexp:/etc/postfix/mime_header_checks

Create /etc/postfix/mime_header_checks and insert

/name=[^>]*\.(bat|com|exe|dll|vbs)$/ REJECT

This will block all emails containg attachments that and in bat, com, exe, dll and vbs. Feel free to add other extension if you want.