Notify an administrator upon account creation

Have you ever wanted to run an external task or notify an administrator or similar when a new user has been created in MDaemon? This is actually possible via a content filter rule in MDaemon.

The content filter is found within the MDaemon GUI under Security | Content Filter, but it’s sometimes easier to modify the cfrules.dat to recreate a complicated rule. The cfrules.dat file is located within the \MDaemon\APP directory and can be modified using plain-text a editor, but please take a backup of this file first!

[Rule995]
RuleName=Take action on new user welcome message
Enable=No
ThisRuleCondition=All
ProcessQueue=BOTH
Condition01=X-Actual-From|starts with|AND|MDaemon@|
Condition02=SUBJECT|contains|OR|Welcome to MDaemon!|Welcome to the email system|Email account information|
Condition03=X-Welcome-Message|does not exist|AND|
Action01=add header|"X-Welcome-Message","True"
Action02=copy to|"123456@example.com"

Feel free to paste this to the bottom of your cfrules.dat file, save, and you can modify it within the content filter editor within the MDaemon GUI. Note that the rule will not be activated until you open the Content Filter and enable it.

If you’re asking yourself why there is a X-Welcome-Message header being created, it’s simple: If your action included sending an email to an external account that was forwarded back into MDaemon, you’d end up with a loop. By using a custom header, we can avoid that loop.

Lastly, verify that you have the option checked in MDaemon for ‘System generated messages are sent through the content and spam filters’ within MDaemon under Setup | Preferences | Miscellaneous.

While the rule in it’s current form is intended to copy the new-user message to a specific account, you can also run an external script or use other Content Filter actions instead.

CC BY-NC-ND 4.0 Notify an administrator upon account creation by Dave Warren (everything-mdaemon.com) is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *

*