Thursday, July 11, 2013

Delete recipient when message is sent from specific domain

Imagine that you want to block message to one of your employee, but only if email is from specific domain. You cannot use Block Message action because it would block message also to other recipients. Better solution is to use Remove Envelope Recipient action which silently remove email addresses.

After quickly defining new rule, we go straight to the actions, choosing Remove Envelope Recipient action from menu.
Remove Envelope Recipient menu

Envelope recipient(s) can be deleted by wildcards, regular expression or plain email address. I'll call my unlucky guy jeff at example.net.
Remove Envelope Recipient action

Now Message Sender condition is needed, because we want to take down recipient only from messages which were sent from i.e. @gmail.com.
Message Sender condition

So, after those two simple steps from now Jeff will never receive any email from gmail.com.

Maybe you have some other ideas how to make life more "happier" for your employees? Try MSH Traffic Policy, it's powerful tool for Sendmail and Postfix.