Please let others know how useful this tip is via the rating scale at the end of it. Do you have a useful Exchange or Outlook tip, timesaver or workaround to share? Submit it to our tip contest and you could win a prize.
Exchange "event sinks" are mechanisms by which a programmer can create custom code that triggers when a certain event takes place in Exchange -- for instance, when new e-mail arrives or when a message is sent out.
Among the various event sink types available in Exchange are SMTP transport event sinks, which can trap and handle all outgoing e-mail messages sent via SMTP.
There's a programmatic quirk to the way SMTP event sinks work. If you use an SMTP event sink to modify the contents of an outgoing MAPI message -- i.e., a message sent using a MAPI client like Outlook -- the modifications will not take.
They'll work without an error. They'll even show up within the scope of the event sink. But once the message is actually sent through SMTP, the changes will not be reflected in the sent message.
The reason for this is subtle, but not all that complicated. When the SMTP event sink fires, Exchange converts the MAPI message to a copy in SMTP format for the event sink to process. But this converted copy isn't actually sent -- it's just used for the event sink's processing. Once the event sink finishes, the converted copy of the message is discarded and the original MAPI message is processed instead.
Microsoft states that this behavior is by design, since the sink is only supposed to modify messages that are received in SMTP format. Otherwise, outgoing mail could be broken before ever being processed.
If you want an SMTP sink to modify all e-mail coming through it, one way to do this is to place the event sink on a border Exchange server, rather than the originating server, or have outbound e-mail sent to a smart host through an SMTP connector. This will force the message to be converted to SMTP first, which will in turn allow it to be modified by any SMTP event sinks.
About the author: Serdar Yegulalp is editor of the Windows Power Users Newsletter.
Do you have comments on this tip? Let us know.
Related information from SearchExchange.com: