Postfix block PDF or ZIP files attachments

by Vivek Gite on August 10, 2007 · 1 comment

Q. How do I block all PDF or ZIP files attachments under Postfix Mail Server?

A. You can easily block email attachments using mime header check.

Open postfix config file

Login as the root, enter:
# vi /etc/postfix/main.cf

Block zip or pdf files

Use mime_header_checks postfix config directive, enter:
mime_header_checks = regexp:/etc/ostfix/block_attachments
Save and close the file. Open /etc/ostfix/block_attachments file and append code as follows:
/name=[^>]*\.(pdf|zip)/ REJECT
Save and close the file.

Restart Postfix MTA

You must restart or reload postfix:
# /etc/init.d/postfix reload

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 1 comment… read it below or add one }

1 Mustafa September 20, 2011

Hi,
This will block attachments for all the accounts on the server, what I want to do is block all outgoing attachments for one account.
Is there is a way to do that ?

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 8 + 8 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: