If you would like to reject messages without some headers you cannot use built-in header_checks content inspection, because it scans one header at a time and does not save state between headers. Making it impossible to detect missing headers.
You need to use 3rd party tool called MSH Traffic Policy. It’s an email management system that allows to set server sided rules for automatic content control and flow administration. Application works as external standalone mail filtering plug-in which integrate with MTA through milter API.
Block an email message
In this scenario we will discard message with Block Message action. But you could also inform sender with some text reply or just temporary reject the message. See below image how options was set.
Detect missing message header
To test message for header which is not present you need to use Message Header condition. It have ability to scan through message and find out which header is missing. Select not have Header option and in Header name field put message-id.
MSH Traffic Policy have many features which you will love:
- take control over you mail flow
- block unwanted spam
- check messages for sensitive content (credit cards numbers etc.)
- limit number of recipients, attachments, message size, number of sent messages
- manage attachments (add, remove, strip, compress)
- modify message headers, sender and recipients
- send new and forward emails to another mailbox
- create server side auto replies
To learn more visit MSH Traffic Policy website.