You can get very creative with MDaemon’s versatile content filter, performing a wide variety of tasks based on an equally wide variety of criteria. In this example, I’ll show you how to create a content filter rule that is triggered on messages sent on weekends only.
Two content filter rules are created – one to insert a date and time header into all messages, and one to act upon messages containing certain letters or words within that header.
First, let’s create our rule to insert a date and time header into all messages.
- In MDaemon, go to Security / Content Filter and click on New Rule.
- Enter a name for your new rule, such as “Add X-CF-Processed.”
- In the left-hand “Conditions” column, check the box “ALL MESSAGES.”
- In the right-hand “Actions” column, check the box “ADD an extra HEADER 1 to message.”
- Click on the blue “specify information” link at the bottom of the window.
- In the “Header name” field, enter the name of the header you want to add. In this case, we’ll call it “X-CF-Processed.”
- In the Header Value field, enter $CURRENTTIME$. This is a macro that will insert the current day, date, and time into the message header.
- Click “OK” to save your header information.
- Click “OK” to save your rule.
Now, we need to create a rule that looks for contents in the header that we created in the previous rule, and acts upon the message based on the contents of that header.
- Click on “New rule” and enter a name for your rule at the top, such as “Weekend Messages.”
- Under the left-hand “Conditions” column, check the box “If the user defined HEADER 1 contains.”
- Click on the blue text at the bottom “userdef1.”
- In the “User Defined Header” window, enter the name of the header we created in our first rule (X-CF-Processed), and then click on OK.
- Click on the blue text “contains specific strings.”
- Since we want this rule to run on weekends only, in the “Check for this string” field, enter “Sat” (without the quotes), and then click on Add. Then, enter “Sun” (without quotes) and click on Add again.
- Click on the word “and” (it will be a blue link), select the “Any or” option, then click on “Ok”.
- Click OK to close the “Specify Search Text” window.
- In the right-hand “Actions” column, select the action you wish to take, such as “DELETE the message” or “COPY the message to FOLDER.” You have many options here, including using macros to send a note back to the sender, copying the message to a custom folder, or moving the message to a custom queue. In this example, I’ve chosen to just delete the message. In addition to deleting the message, you could go one step further and send a note back to the sender of the message informing him or her that the message was deleted.
- Click “Ok” to save your content filter rule.
Using this technique, all messages sent on weekends will be handled based on how you have configured your content filter. You can get very creative with the content filter, so I recommend trying different filtering rules and macros in a test environment to become familiar with its versatility.