We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Parsing Delivery Service Notification (bounce) emails

I’m using Aspose Email to send/receive emails and have setup a ReturnPath mailbox to collect delivery notifications from outbound emails. I’m setting a MessageId on the outbound header so that I have a unique identifier for each email message.


The ReturnPath mailbox is receiving emails and I’m able to read them via the POP client, but I’m not sure what is the best way to parse them to read the delivery information to determine which are Delayed, Failed, Successfully Delivered etc. and the reason why an email delivery may have failed (mailbox full, address unknown etc.)

There seem to be quite a few .Net libraries that parse the emails and return simplified ‘Bounce’ information, is there a way to do this with Aspose?

Thanks,
Claire

Hi Claire,


Thank you for using Aspose.Email.

The return emails have some information about the status of such emails in their subject that, I believe, can be used to parse messages arrived due to numerous reasons e.g. delivered messages have their subject starting with “Delivered:”. Based on such keywords, MailQueryBuilder can be used to parse such emails depending upon your required search criteria. You can also combine multiple conditions check by using builder.Or(conditions).

// Set conditions
MailQueryBuilder builder = new MailQueryBuilder();

// Subject contains "Newsletter"
builder.Subject.Contains("Delivered");

// Build the query
MailQuery query = builder.GetQuery();

// Get list of messages
Pop3MessageInfoCollection messages = client.ListMessages(query);