I'm looking for a way to create a transport rule with Exchange 2013 on premise, which permit to "Reject the message with explanation" for incoming email sent to email@example.com which do not contains any attachment.
So, only emails with attachments should be accepted.
fred3rd always give me a way for using header patterns, but unfortunately, it doesn't works because Exchange rules don't accept blank character.
The rule is :
New-TransportRule -SentTo firstname.lastname@example.org -HeaderMatchesMessageHeader 'X-MS-Has-Attach' -HeaderMatchesPatterns @('') -RejectMessageReasonText 'Send An Email With Attachment' -Name 'Reject Email Without Attachment'
So, using :
are not accepted and return :
"a regular expression specified for a transport rule must contain at least one non-blank character".
Any idea ?