+2 votes

I just updated to v3.0.16292.1158 of Mail.dll via Nuget and am getting the following two compiler warnings:
warning CS0618: 'Bounce.Examine(IMail)' is obsolete: 'Please use ExamineAll instead.'
warning CS0612: 'BounceResult.IsDeliveryFailure' is obsolete

The code that is getting the warnings was based on your bounce-handling code:
https://www.limilabs.com/blog/bounce-handling

So my question is, how should bounce handling code be changed, given these two deprications? I get that ExamineAll returns a list of BounceResult, but without BounceResult.IsDeliveryFailure, I'm not sure how to proceed.

Thanks for the fantastic library!

by (300 points)
Thanks!!

Got it: If ExamineAll returns an empty list, no bounces were detected.

We're using bounce processing to update our user database when emails fail.  Since we will now get a list, will BounceResult.Recipient be the same for each BounceResult returned by Bounce.ExamineAll?  In other words, if we only care about the recipient email address, can we just process the first BounceResult instead of iterating the list?

Fyi: In your example, the variable "isDeliveryFailure" is not not used:
bool isDeliveryFailure = results.Count > 0;
Generally, bounce can contain multiple failed recipients. It doesn't happen very often, but it is possible. I think it can only happen if you send email to more than one recipient.
Sorry, I think I need to clarify my question.  Let's say Bounce.ExamineAll returns a list of two BounceResult objects.  Will each object have the same value in its Recipient property?

Rephrased, will lst[0].Recipient == lst[1].Recipient?
No, definitely not.

1 Answer

0 votes

I get that ExamineAll returns a list of BounceResult, but without
BounceResult.IsDeliveryFailure, I'm not sure how to proceed.

All objects returned by Bounce.ExamineAll represent delivery failure. There's no need to check BounceResult.IsDeliveryFailure, as it will always return true.

If email is not delivery failure Bounce.ExamineAll is goring to return empty list.

Hope this helps.

by (301k points)
...