======SMTP Service - Filtering====== The [[SMTP Server]] -> Filtering tab lets you set up filtering of messages going through the VPOP3 SMTP service. This may be incoming SMTP messages, or locally sent messages. =====SMTP Rules===== SMTP Rules let you create custom rules for processing messages as they go through the VPOP3 SMTP service. The option **Local SMTP Rules on each connection** is usually turned off. If this is turned on, then VPOP3 will load the SMTP rules every time an SMTP session starts. This is useful if the SMTP rules are being modified by something outside of VPOP3. Otherwise, VPOP3 will only load the SMTP rules whenever they are modified from within VPOP3. The **Reload SMTP Rules** button lets you manually reload the SMTP rules SMTP rules are processed at various times during the SMTP transaction - at the **MAIL FROM**, **RCPT TO** and **DATA** stages. VPOP3 picks the appropriate stage to test the message depending on the fields being tested - for instance, if a rule checks only the 'return path', then it can be checked in the **MAIL FROM** phase, but if it checks a message header, it has to be checked during the **DATA** phase. ====Edit SMTP Rules==== To edit the SMTP rules, press the **Edit SMTP Rules** button. This brings up the SMTP Rules list. Each row in the rule list is a 'rule'. VPOP3 processes the rules in order, from top to bottom. When it finds a rule which matches the message, it will process that rule, then not process any more rules. To add a new rule, press the '+' icon. To delete a rule, press the 'bin' icon next to the rule. To move a rule up or down in the list order, use the 'arrow' icons next to the rule. ===Adding or Editing a rule=== Press the '+' to add a new rule, or click on the rule name to edit an existing rule The **Rule Name** is a name for you to refer to the rule The **Rule Type** is the action to perform when the rule matches: * **Accept** - the message is accepted as normal * **Ignore** - the message appears to be accepted, but is silently discarded * **Reject** - the message is rejected with an error message to the sender * **Hold** - the message is accepted, but 'held' once it is placed in the VPOP3 OutQueue, or user's mailbox * **Redirect** - the message is redirected to the specified address instead of to the original target * **Copy** - the message is copied to the specified address as well as to the original target ==Redirect/Copy== If you want to copy/redirect a message to more than one address, you can use a Distribution List to do this If you want to copy/redirect a message to a specific folder for a local user, you can use the format ** **, eg **bob Sent Items**, which will copy the message to the 'Sent Items' folder for the user 'bob'. ===Conditions=== You can tell VPOP3 to require all the conditions to match before triggering the rule, or to only require any one of the conditions If no conditions are defined, then the rule will always trigger. Press the green '+' icon to add a condition', or the red 'x' to delete a condition Each condition will compare data about the message with some test data. The data which can be checked are: * **Subject** - the value of the message's 'Subject' header field * **From** - the value of the message's 'From' header field * **To** - the value of the message's 'To' header field * **Cc** - the value of the message's 'Cc' header field * **Return-Path** - the 'MAIL FROM' value of the SMTP envelope * **Recipient Address** - the value of any recipient of the message - for local users this is after Aliases etc have been expanded * **This Recipient Address** - the value of the current recipient being processed (during the 'RCPT TO' phase) * **Recipient Count** - the number of recipients of the message so far * **Sender IP Address** - the IP address of the message sender talking to VPOP3 (not necessarily the original sender's IP address, if the message has gone through other servers on it's route) * **Authenticated Sender** - the local authenticated sender, if any * **Size** - the message size (in bytes) * **Day Now** - the day of the week now * **Time Now** - the time now * **Other Header** - you can type in another message header field name in the next box to use any message header field. Note that you can NOT check the message body content (or attachments, etc) using SMTP rules If you need to check the message body, or attachments, you may need to use a [[spam_filter_rules|custom Spam Rule script]] =====Spam Filter===== The **Enable Spam/Content filter on SMTP messages** option enables the spam filter for messages going through the SMTP service. (This is the same settings as in **[[Settings]] -> [[Spam Filter]] -> [[spam filter general|General]]**