Retrieve undelivered emails

Hi,

How do I retrieve a list of undelivered emails using your API?

Hi Mark,

Thank you for writing to us.

I think you want information about retrieving messages that couldn’t be delivered. I have checked this with various messages and would like to share with you that Undelivered messages have contents class equal to “REPORT.IPM.Note.NDR”.

Please have a look at the following example that retrieves all such messages from an Exchange Server using EWS. It uses ExchangeQueryBuilder to retrieve a list of all such messages. Please feel free to contact us if you need further assistance in this regard.

ExchangeWebServiceClient client = GetExchangeClient();
ExchangeMailboxInfo exchangeMailboxInfo = client.GetMailboxInfo();
ExchangeQueryBuilder builder = new ExchangeQueryBuilder();
builder.ContentClass.Equals("REPORT.IPM.Note.NDR");
MailQuery query = builder.GetQuery();
ExchangeMessageInfoCollection msgInfoCollection = client.ListMessages(exchangeMailboxInfo.InboxUri, query, true);
foreach (ExchangeMessageInfo msgInfo in msgInfoCollection)
{
    MailMessage mailMsg = client.FetchMessage(msgInfo.UniqueUri);
    //Do the required work with mailMsg
}

Hi Kashif,


That certainly helped me. Thank you.

However, when I try to get the original “To” field from the retrieved undelivered messages, it doesn’t work. Can you help in this? I want to get a list of all undelivered messages and retrieve the original email address to which the email was sent to.

Hi Marc,


I was able to observe this issue using the latest version of Aspose.Email for .NET 2.5.0 and have logged this issue in our bug tracking system for further investigation by our development team. Once there is any information in this regard, we’ll update you here via this thread.

This issue has been logged as NETWORKNET-33624 in our issue tracking system.

The issues you have found earlier (filed as NETWORKNET-33624) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.