Can I create a policy to block emails based on subject line?

Occasional Contributor

I have spam coming with a specific subject line;  is there somewhere in the Admin Portal where I can block emails coming into my organization based on the subject line exact phrase? 

7 Replies
best response confirmed by filmtech (Occasional Contributor)



Yes, it's under Exchange Admin Center > Mail Flow, below link can help step by step:


Office 365 Mail Flow Rule: Block Messages Based on Subject | LazyExchangeAdmin

Thanks -- but one step is confusing. It indicates, "type the keyword #SYSGEN#" --- why block on SYSGEN? Shouldn't I be blocking on the phrase in the subject line that contains the spams we've been getting?



It just an example to block Email by 'keywords' under subject, the sample showing that Email will be block once #SYSGEN# contains in Email subject, you can decide whatever you want to fit your purpose.


Hope this help

Got it -- are the hashtags around the phrase necessary?



You are welcome, hashtags around are NOT necessary, I thought the sample confused you.


I was a bit confused yes. Instead of #SYSGEN# perhaps indicate something like [add the text of the subject line here]. In any case my hat's off to you. I followed your instructions and successfully implemented a mail flow rule!



You are welcome, not sure you are interested to 'Regular Expression', refer below URL:


regex - Regular Expression for some email rules - Stack Overflow