Changing 'From' of outgoing NDR message don't allow to leave message from <OnSubmittedMessage> and to pass the message further to <OnResolvedMessage> and so on. RRS feed

  • Question

  • We have 4 Authoritative domains in Exchange 2010 SP3, for example: c, xyz.com, default.com, admin.com.

    We develop routing transport agent to change as P1/P2 '"From" as "Recipient" and "To" .

    Almost all functionality we place to OnSubmittedMessage event handler section.

    Some of mailbox enabled users has receiving message size limit set up for example to 2 Mb only per mesage.

    Let' s image the situation: some of mailbox enabled users with 2Mb receiving message size limit mail address with abc.com sends a message with attachment of 5 Mb to user with mail address as of abc.com, as xyz.com, it doesn' t matter.

    For example user of peter@abc.com with 2 Mb receiving message size limit sends message with 5 Mb attachment to user steve@xyz.com (there are not any message size restrictions for the user) .

    But there is no user with mail address of stieve@xyz.com. And NDR is generated.

    By default NDR for internal users do not have P1 "From" and have P2 "From" only.

    As following, in the case generated NDR have:

    e.MailItem.Message.From.SmtpAddress = MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@default.com

    e.MailItem.Message.Sender.SmtpAddress = MicrosoftExchange329e71ec88ae4615bbc36ab6ce41109e@default.com

    But we want to change this NDR "From" to, for example error@admin.com, and for it at OnSubmittedMessage we do the following:

    e.MailItem.Message.From = new EmailRecipient("Our Local Postmaster", "error@admin.com");
    e.MailItem.Message.Sender = new EmailRecipient("Our Local Postmaster", "error@admin.com");


    e.MailItem.Message.From.SmtpAddress = "error@admin.com";
    e.MailItem.Message.From.SmtpAddress = "error@admin.com";

    And such NDR don' t leave OnSubmittedMessage and don' t pass to next event handlers - OnResolvedMessage and so on and as a result such NDR is not delivered to peter@abc.com.

    By Get-MessageTrackingLog -Recipients peter@abc.com we can see 2 messages:


    source: DSN

    eventId: DSN

    message subject: it is impossible to deliver: original subject

    RecipientStatus: {}


    source: routing

    eventid: fail for the NDR

    RecipientStatus: {550 5.2.3 RESOLVER.RST.RecipSizeLimit; message too large for this recipient}

    And nothing else even NDR with "550 5.2.3 RESOLVER.RST.RecipSizeLimit" is not sent to peter@abc.com.

    If we send message with less then 2 Mb (sender limit for receiving message) or don' t touch NDR "From" or we place changing of NDR "From" to OnResolvedMessag, all work as expected.

    We see that it is because size of sent and then returned message as attached at NDR.

    But as there is Message size limits written:

    The following list shows the types of messages generated by a Mailbox server or an Edge Transport server and exempted from all message size limits:

    • System messages

    • Agent-generated message

    • Delivery status notification (DSN) messages

    • Journal report messages

    • Quarantined messages

    So, it wouldn' t have to affect to this situation.

    And by our feelings, when we change "From" at OnSubmittedMessage Exchange either fork or clone or create new message with changed (new) "From" and resolve recipients again. And when Exchange resolve recipients again, it check for size limits and then generates NDR with "550 5.2.3 RESOLVER.RST.RecipSizeLimit; message too large for this recipient" .

    Why so and how is to change "From" for NDR at OnSubmittedMessage that it could wortk and it could be sent to peter@abc.com successfully ?

    • Edited by Alex_Oooo Monday, March 26, 2018 9:53 AM
    Monday, March 26, 2018 9:50 AM

All replies

  • Based on Pipeline tracing, I discovered out that there is Journal Agent subpart at OnSubmittedMessage as at OnRoutedMessage.

    And my agent activity is broken by Journal Agent subsection.

    How is to catch Journal Agent by my transport agent ?

    • Edited by Alex_Oooo Thursday, March 29, 2018 11:11 PM
    Thursday, March 29, 2018 9:52 PM