How can I reject a message with a particular subject using a Sieve script?
If you would like to reject messages that match a particular subject header, you can do so with a Sieve script. It will reject the message with a 550 error and reason text you will supply.
Log into the SecurityGateway administration website with a global administrator account
Click on Security
Locate the Advanced section
Click on Sieve Scripts
Click New
Enter a descriptive Script Name
Select Data from the 'Mail Event:' dropdown
Select the scope you wish to use
If using a scope of Domain, select the domain you wish to apply the script to in the 'Domain:' dropdown
Enter this script in the box labled 'Script Text:'
require 'reject'; if header :is 'subject' 'Subject to look for' { reject 'I don't want your spam'; }
Edit 'Subject to look for' to reflect the subject you wish the script to look for. Retain the double quotes around the information.
If you wish to edit the reject message returned with the 550 error you may do so, but keep it enclosed in double quotes.
Click Save and Close
Additional Comments
Please note that this script looks for an exact match to the subject header you provide. A subject that contains the information you provide plus more will not be rejected. If you wish to reject messages containing that information instead of matching, change 'if header :is' to 'if header :contains' to do so.
The same task can be accomplished through the Message Content Filter in SecurityGateway, however this article is provided as an example for those interested in learning about Sieve.