Open p231970 opened 7 years ago
I think issue is in file BounceDetectResult.cs on line 182 look this screenshot http://prntscr.com/e12wlv
Please, create a (failing) unit test that triggers this behavior.
I am new to GitHub so sorry for maybe wrong editing. I hope you'll find all my proposed changes in few patches
I'm running into the same issue. In debugging down to this, the UndeliveredMessagePart does not contain a member of 'Message', so the exception is thrown. I'd like to help out with this, but haven't got any idea how to create a failing unit test. I have a couple of these bounces in a folder on an inbox, I can forward them to you- they are AOL bounces.
For the time being, I've just commented this segment out, as I'm not interested in the UndeliveredMessageId, but I know this isn't something that's a good option for most.
In addition to ToddHedenstrom's comment I added extension method:
public static bool HasMethod(this object objectToCheck, string methodName) { var type = objectToCheck.GetType(); return type.GetMethod(methodName) != null; }
And changed line 179 to:
if (UndeliveredMessagePart != null && UndeliveredMessagePart.HasMethod("Message"))
Now works well with message id.
I have this System.InvalidCastException: Unable to cast object of type 'MimeKit.TextPart' to type 'MimeKit.MessagePart'. at MailBounceDetector.BounceDetectResult..ctor(MimeMessage message, MimeEntity deliveryNotification, MessageDeliveryStatus deliveryStatus, MimeEntity undeliveredMessagePart) at MailBounceDetector.StandardBounceDetector.Detect(MimeMessage message) at MailBounceDetector.BounceDetector.Detect(MimeMessage message)