rgl / MailBounceDetector

Detects whether a MailKit email Message is a bounce message
MIT License
28 stars 12 forks source link

Parsing extended status codes #7

Open p231970 opened 7 years ago

p231970 commented 7 years ago

I got extended delivery status code which crashes detector. Action: failed Status: 5.7.133 Diagnostic-Code: smtp;550 5.7.133 RESOLVER.RST.SenderNotAuthenticatedForGroup; authentication required; Delivery restriction check failed because the sender was not authenticated when sending to this group

I propose this to fix an issue:

    private static BounceStatus ParseBounceStatus(string statusCode, IDictionary<int, string> statusCodes)
    {
        var value = int.Parse(statusCode);
        if (statusCodes.ContainsKey(value))
            return new BounceStatus(value, statusCodes[value]);
        else
            return new BounceStatus(value, "");
    }