Attaching HTML signatures

MDaemon’s content filter has an “Append a corporate signature” rule which can be used to add a block of text to the bottom of message.  However, if you attempt to use HTML, the HTML code gets inserted into plain text signatures too.

I created a content filter rule hack around this limitation.

Basically what this rule does is the following:

Action01) Add the “plain-text” version of the signature with a special tag (/zzz/)
Action02) Clean up the special tag from the plain-text version.
Action03) Remove most of the signature from the HTML version.
Action04) Remove the rest of the signature from the HTML version and insert the HTML signature.

So, if you’re feeling brave, backup your \MDaemon\App\ directory and get started.

To “install” this content filter rule, copy the below lines and paste them into the very top of very bottom of your \MDaemon\App\cfrules.dat file, then go into MDaemon’s Content Filter and activate the rule.

[Rule001]
RuleName=HTML sig - TEST RULE
Enable=No
ThisRuleCondition=All
ProcessQueue=BOTH
Condition01=FROM|contains local account|AND|
Action01=add footer|"/zzz/1 corporate signature/zzz/","/zzz/2 corporate signature/zzz/","/zzz/3 corporate signature/zzz/"
Action02=body search and replace|"^/zzz/(.*)/zzz/$","\1","0,1"
Action03=body search and replace|"(<br>|^)/zzz/.*/zzz/<br>","","0,1"
Action04=body search and replace|"(<br>|^)/zzz/.*/zzz/</html>","<br><font color="#ff0000"><i>1 corporate signature</i></font><br><font color="#3366ff" size="-2">2 corporate signature</font><br><a href="http://www.example.com/">3 corporate signature</a><br></html>","0,1"

The rule is hardcoded to only function if a message is FROM a local account, but you’ll want to test this in your environment to make sure that no other mail gets a signature added. I’d suggest adding a “If the TO HEADER contains” condition to test the rule.

After “installing” the rule, open the rule in the Content Filter GUI editor (MDaemon –> Security –> Content Filter), edit the rule, then edit the “then add footer” (Action01) section to contain your corporate signature. However, add a /zzz/ to the start and end of each line. In other words, if you want your signature to look like this:


My Name
My Title
My Company
www.example.com

then what you’d enter would be

/zzz/– /zzz/
/zzz/My Name/zzz/
/zzz/My Title/zzz/
/zzz/My Company/zzz/
/zzz/www.example.com/zzz/

Don’t worry, the /zzz/ won’t show up to users, this is just a trick to allow the following actions to identify the signature. Action02 cleans up the /zzz/ code from the plain text version.

Action03 and Action04 are where the “magic” happens, these actions modify the HTML portion of the message and remove the signature we just finished adding, and then Action04 adds the HTML version of the signature.

Edit the very last “and body – search and replace” condition, don’t touch the “Search Expression” at all, only change the “Replace With”, replace it with your corporate signature, and add a tag to the end.

Hopefully this works, it appears to work in my own testing, but I’d appreciate comments if you either are successful, or can’t get it working. Please comment here, don’t use the “Feedback” link requesting technical support.

Note that while you can add HTML, it’s not yet possible to add a corporate logo — You can link to an image on the web, but many/most mail clients won’t display said image.

UPDATED (2011/02/01): Made minor tweaks to content filter rule

Welcome to mdaemonplugins.com users!

Some time ago I acquired mdaemonplugins.com and I have recently redirected the site to it’s new home here on Everything MDaemon.

I will be migrating content from the original MDaemon Plug-ins site as quickly as possible, feel free to bookmark this category to only see plugins, or read the rest of the blog for other tips, tricks and ideas.

If any authors of a plug-in would like me to remove or update plug-ins, or would like access to maintain your own plug-in, please contact me

To users, please be aware that Everything MDaemon is not responsible for the development or technical support for plug-ins. Plug-ins are not reviewed or tested, and include no warranties implied or explicit.

NewMessagesAreSeen

When a new message is added to a folder, it is marked UNSEEN (IMAP only), NEW (WorldClient only) and UNREAD (IMAP and WorldClient).

This is normally desired as it makes it easy to pick out new messages, but when you are using BCC-to-sent-folder, or sharing out a bayesian learning folder, for example, this may not be desired.

If you just want mail to appear as “Read” rather then the default IMAP flags, edit the HIWATER.MRK file within the message folder directory and set the following key:

[Settings]
NewMessagesAreSeen=Yes