Changing the default domain in DSNs for Exchange 2000 (SP3 or greater) and Exchange 2003
Published Mar 26 2004 08:19 AM 1,022 Views

Some customers running Exchange are responsible for multiple SMTP domains in their org.  For example, they are running a single Exchange server at a corporate level, but their individual branches have their own SMTP domain.  That way, when people do business with them at a local level, it looks like a local community business, as opposed to a huge corporation.  This works great, however with this topology, if a person types a wrong email address (, the NDR response comes from the main SMTP domain at the corporate level (i.e.

The default DSN sink generator appends the default domain of the exchange organization to “From: postmaster@” and that forms the 822 from of the DSN message. You can override this domain, by implementing a transport event sink.

The interface the event sink will need to implement is as follows: You will need exchange 2000 SP3 or Exchange 2003. This interface is defined in smtpevent.idl. You will need other transport idl files to implement this transport event sink. All of them should be available in IIS Platform SDK available at

interface IDSNGenerationSink : IUnknown
HRESULT OnSyncGenerateDSN(

    [in]  ISMTPServer                 *pISMTPServer,
    [in]  IDSNSubmission              *pIDSNSubmission,
    [in]  IMailMsgProperties          *pIMsg,
    [in]  IMailMsgPropertyBag         *pIDSNProperties,
    [in]  IDSNRecipientIterator       *pIRecipIter);

You can implement a higher priority sink. Implement this interface and you really need to handle only this method in the interface listed above.

You will need to override the value in this property DSNPROP_SZ_DEFAULTDOMAIN. This property is also defined in smtpevent.idl. Use the pIDSNProperties->PutStringA to set and override the default value, to specify the domain that you really want.
Just return S_OK from there.

- Pretish Abraham

[Updated to correct typo related to version requirements, thanks for pointing it out]

Version history
Last update:
‎Jul 01 2019 02:54 PM
Updated by: