Resending an Undelivered Message

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

A transport provider sends a non-delivery report (NDR) when it cannot successfully deliver a message that you have submitted. It is up to the client whether or not users can attempt to resend these undelivered messages. If you support resending messages, you can either use a form provided by MAPI or implement your own. The MAPI form displays the names of the failed recipients and the reason for the delivery failure, if possible, and includes a button that, when selected, allows a user to resend the message.

When a resent message is received, it should look exactly like the original message. The recipient should be unable to differentiate between a message that was delivered on its first attempt at transmission or a subsequent attempt. Replies on this message should work exactly as if the message had been sent successfully the first time.

To resend an undelivered message

  1. Call IMAPIFolder::CreateMessage to create a new message.

  2. Copy all of the properties from the original message, excluding the PR_MESSAGE_RECIPIENTS (PidTagMessageRecipients) property, and the PR_SENDER and PR_SENT_REPRESENTING properties. Make the following property modifications:

    • Set PR_MESSAGE_CLASS (PidTagMessageClass) to the report's PR_ORIG_MESSAGE_CLASS (PidTagOriginalMessageClass) property.

    • Set the MSGFLAG_RESEND flag in the PR_MESSAGE_FLAGS (PidTagMessageFlags) property.

    • Set PR_ORIGINAL_ENTRYID (PidTagOriginalEntryId) to the original message's PR_ENTRYID (PidTagEntryId) property.

    • For each recipient, set MAPI_SUBMITTED in the PR_RECIPIENT_TYPE (PidTagRecipientType) property.

    • Duplicate each failed recipient. Change the PR_RECIPIENT_TYPE property for the duplicated recipient to MAPI_P1. Therefore, for each failed recipient there are now two entries in the recipient table: one with PR_RECIPIENT_TYPE set to its original value and the other with PR_RECIPIENT_TYPE set to MAPI_P1.

  3. Call ScCreateConversationIndex to set up conversation tracking if desired.

  4. Call the new message's IMessage::ModifyRecipients method to update the recipient list.

  5. Call IMessage::SubmitMessage to save and send the new message.