Prevent sending of 1KB pdf files

antonioking
antonioking used Ask the Experts™
on
One of my departments uses some software that emails out pdf attachments
Occasionally a fault may occur with the software which results in blank pdf files being sent.

Fairly embarrassing when this happens, usually we don't notice until a recipients contacts us querying why the pdf is blank

Is it possible with Exchange 2010 to create a rule that will stop an emails from being sent if it contains a pdf that is 1KB OR SMALLER?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
LAN/WAN Systems Administrator
Commented:
I'm looking at Exchange 2013 but I'd configure the rule using an exception like this:

Apply this rule if
-Any attachment's file extension matches - PDF
Do the following
-Block the message - Reject with reason
Except if any attahment's size is
-Any attachment size is greater than or equal to - 2KB
New-TransportRule 'Block Empty PDFs' -AttachmentExtensionMatchesWords 'pdf' -ExceptIfAttachmentSizeOver '2 KB' -RejectMessageEnhancedStatusCode '5.7.1' -RejectMessageReasonText "You Tried to Send an Empty PDF"

Open in new window


This won't catch them if the message has more than one attachment though.  If there is always 1 attachment per message this will work.
Zacharia KurianAdministrator- Data Center & Network

Commented:
why can't you configure the "software" not to create a blank page?

have tired creating such rule in outlook?

Author

Commented:
Thank you mcsween
Your code worked, allthough switch -AttachmentExtensionMatchesWords is not recognised in Exchange 2010 so I replaced this with
-AttachmentNameMatchesPatterns ' *.pdf'

Open in new window


Regards
Antonio

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial