Prevent sending of 1KB pdf files

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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mcsweenSr. Network AdministratorCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Zacharia KurianAdministrator- Data Center & NetworkCommented:
why can't you configure the "software" not to create a blank page?

have tired creating such rule in outlook?
antoniokingAuthor 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

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.