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 (firstname.lastname@example.org), the NDR response comes from the main SMTP domain at the corporate level (i.e. email@example.com)
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 http://www.microsoft.com/msdownload/platformsdk/sdkupdate/.
interface IDSNGenerationSink : IUnknown
[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.
[Updated to correct typo related to version requirements, thanks for pointing it out]