Thursday, July 09, 2009

Exchange 2010 Hub Transport - building an automated signature

Update - 5/14/2012 - Per popular demand in the comments, I am highlighting up front that this method does not work as expected.  It attaches a signature at the bottom of every EMAIL, and not at the bottom of every new message.  So the bottom of a reply/all email will have everyone's signatures in a non-desirable manner.  I had hoped that in service packs MSFT might have updated this to deliver a more desirable result, but this has not yet occurred.  Thanks to my readers and commenters for asking me to update this!

This article is something I wish I could have done in 2007. You can now not only do disclaimers appended to an email, but you can customize the appended data using macros surrounded by two percent signs… for example %%displayName%% would display your Active Directory AD Display Name.
Do note that for these rules to fire, your outbound SMTP must be Exchange 2010. I haven't gotten that far into our migration yet, but created a new send connector to another domain to explicitly route out the 2010 server.
Reasons why you want to do this:
  1. Rich text sigs currently attach as images to each sent item and each reply. At 5-10k per message, that adds up a LOT under volume. With transport based signatures, these are applied on sending, and not saved in sent items. Since we use an IMG tag to support the image, it can go on an externally hosted web server.
  2. Corporate control of signature content based on Active Directory gives a LOT more centralized control. If we allowed marketing the ability to update this transport rule via the new Exchange control panel - they could add/update the marketing line in one place instead of asking employees to comply to a policy.
Below are the steps to create the Transport Rule (note that these all say edit - I didn't take initial screenshots, but the steps are identical)

So now, let's see what that looks like on the receiving end:

Ick. Not exactly pretty. And it missed the newline I entered. Let's see what we can do with this. Trying HTML:

This results in:

I obviously skipped the tough part here just to proof of concept the formatting.
Let's see if some insane winword formatted HTML makes this break - Best practice here would be to have your web development company trim this down a LOT. This text block is 5k!

This got me here - can you tell which is from Outlook and which is generated? ( I fixed the </ there after!)

To make the HTML more navigable, I got it down to about 1kb!

OK, so we now KNOW we can duplicate a rich text signature - let's see what I can make work from AD. This is far from a complete list, just what I found with some gentle poking. I expect that Microsoft will eventually list a complete mapping of Macros to fields. If that doesn't happen for a long time, I will update this post or make a new one to list more.
Display Name%%displayName%%
First Name%%FirstName%%
Last Name%%LastName%%
Business Phone%%Phone%%

Unfortunately, I have not yet been able to find a slick way to pull Manager's email address out of this to REALLY complete the same effect.

That transport sig cost zero kb in the sent items, but if someone replies will add the 1k of html to the replied to email. Still a decent reduction if you multiply over many users and many emails.
Not too shabby, right? Now - other things like the certifications or the second phone number can be applied by either different transport rules based on departments, or by inserting additional desired fields into other attributes. If a marketing department wants to cross sell services more, they can put the top ten technologies on one transport rule, and the Exchange 2010 seminars on another transport rule, and modify the rules to apply by distribution group membership.

Labels: ,


At August 06, 2009 6:29 AM , Anonymous Anonymous said...

Cool, thnx for the info.

Just tried it and it works realy well.

At January 18, 2010 2:46 PM , Blogger Iceknight said...

These codes should mostly work:

At August 12, 2010 3:50 PM , Blogger Thugn said...

This works wonderfully for most instances. The exception I have found is with Blackberry devices. The blackberry renders all emails in plaintext. Emails created via blackberry will show all the HTML tags (i.e. body html b ) Has anyone found a fix for this?


At August 16, 2010 7:54 AM , Blogger Franziska und Patrick said...

thx for the info!!
i have the same exeption by sending a mail with an iPhone. html tags are visible and breaks doesn't work. any ideas?

At August 31, 2010 9:28 AM , Blogger Travi said...

Awesome, thanks for the help!

At November 29, 2010 1:15 PM , Blogger Lance said...

Great, but how does one add the signature to the end of the body and not the entire email? Is there a switch for removing the "append" option?

At March 17, 2011 2:53 PM , Blogger Cheryl said...

The problem with this is that signature appears at the very bottom of the email, so if there is conversation it keeps going to the bottom...any thoughts?

At April 11, 2011 9:39 AM , Blogger Chris said...

Cheryl - Yes, this is the MAJOR lacking of this. It really looks awful after the second or third reply in a row. I never bothered updating the post regarding this, sorry about that. There are third party tools for standardizing sigs at the server and desktop levels.

At May 18, 2011 4:08 PM , Blogger Rich said...

what i did to fix this was add

or except when the Subject field or message body contains 'this message is strictly prohibited'

which in the bottom of our disclaimer
Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient and received this in error, please contact the sender by reply e-mail. You are hereby notified that the copying, use or distribution of any information or materials transmitted in or with this message is strictly prohibited.

At October 19, 2011 3:30 PM , Blogger jchongers71 said...

I have a small problem with this. How do you handle forwards and replies? When this rule is active if a user replies to a message or forwards a message, you will have a long list of signatures at the bottom of the email, instead of each signature after the body of the message.

At March 07, 2012 12:20 PM , Blogger Scott Mckenzie said...

With regard to forwards and replies, i have set an Exception that goes as follows:

"except when the Subject field contains specific words"

and then added:

Re: and Fw:

This seems to work for the most part.. it's not perfect but hey!

At May 13, 2012 9:56 PM , Blogger SexyTan said...

Could you please amend this to say at the very top that in order for this to work like a signature and place the transport rule on the bottom on each new email and not the enitre email that they have to purchase third party software? Please. I spent a week setting this up only to find that I could not use it :( :( :(

At May 24, 2012 3:56 PM , Blogger Corbett Enders said...

As Rich has already said, you can enforce only a single signature per thread by:

create an exception on the transport rule for "when the Subject field or message body contains" and include a portion of the signature text (such as their title or phone number, etc).

At August 01, 2012 2:21 AM , Blogger Rutger de Boer said...

What you can do to fix the problem of disclaiming every email:

$text="(html)(Body)(div)(p)(font size='2' face='Arial')YOUR HTML CODE GOES HERE(/font)(/p)(/div)(/body)(/html)"
New-TransportRule -Name "Your Rule Name" -SentToScope NotInOrganization -SenderADAttributeContainsWords "customattribute2:VALUE" -ApplyHtmlDisclaimerText $text -ExceptIfRecipientAddressContainsWords $domainList -ExceptIfHeaderContainsMessageHeader "X-DisclaimerAdded" -ExceptIfHeaderContainsWords {Default} -ApplyHtmlDisclaimerLocation Append -ApplyHtmlDisclaimerFallbackAction Wrap -SetHeaderName "X-DisclaimerAdded" -SetHeaderValue "Default"

This will put a value: X-DisclaimerAdded to every mail and at the same time let's the rule fire only on messages that have no such value in the header.

All <> HTML tags have been replaced.

At August 03, 2012 9:25 AM , Blogger Doodlebug Dinglehoppe said...

An alternative to having only one signature is to prepend it instead of append. Then the signature shows up properly at the top of each reply.

At August 03, 2012 9:27 AM , Blogger Doodlebug Dinglehoppe said...

An alternative to having only one signature is to prepend the text instead of appending it. Then the correct behavior is exhibited.

At December 11, 2012 8:26 AM , Blogger gopher said...

I create an except and when I answer I dont attache a signature, but I wont atache something like second signature or small info which containe only "best regsard and my phone number" how do i do this ?

At May 02, 2013 6:32 PM , Blogger arjay said...

Hi Everyone,
Is there an update or a summary of solutions to this problem as of 3/5/2013.

Does Issue still exists and what have you found to be the best solution you now have in production? ie has anyone revised how they are doing this now?

my main issue is that i need to pull info in for for MAC Clients from AD to toe the corporate brand line...which is something none of the signature manager programs alot of them push a client msi to windows computers and therefor do not support outlook for mac 2011.

Many thanks to all who posted, i will look into testing them out

At June 18, 2013 10:42 AM , Blogger Sheldon Marquez said...

Prepend does not exhibit "normal" behavior if you are attempting signature blocks. The signature block should appear directly AFTER your text, where as prepending will generate the signature block BEFORE your text.

At February 11, 2014 5:17 PM , Blogger Randescy said...

How do I run an "if" check on these commands? IE some users want to list there home phone number and I don't want that to show as a blank line if it isn't in AD. With vbscripting was easy to figure out. This exchange built in Macro thing not so much.

Basically I want to do this:
if %%homePhone%% then %%homePhone%%


Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home