You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the following esp_event from a Mailgun webhook:
{
'attachment-count': '1',
'code': '5.1.1',
'domain': 'mg.otovo.no',
'error': 'smtp;550 5.1.1 RESOLVER.ADR.RecipNotFound; not found',
'message-headers': '[["Received", "from drex02.felles.ds.nrk.no (2002:a043:8763::a043:8763) by MAEX02.felles.ds.nrk.no (2002:a043:8797::a043:8797) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 26 Apr 2017 21:40:34 +0200"], ["Received", "fromEUR02-VE1-obe.outbound.protection.outlook.com (213.199.154.48) bydrex02.felle...,
'message-id': 'xxx@mg.otovo.no',
'tag': 'calculation',
'token': 'exxx'
}
esp_to_anymail_event fails with a ValueError trying to turn '5.1.1' into an int.
Stacktrace:
ValueError: invalid literal for int() with base 10: '5.1.1'
File "django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "anymail/webhooks/base.py", line 109, in dispatch
return super(AnymailBaseWebhookView, self).dispatch(request, *args, **kwargs)
File "django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "anymail/webhooks/base.py", line 123, in post
events = self.parse_events(request)
File "anymail/webhooks/mailgun.py", line 41, in parse_events
return [self.esp_to_anymail_event(request.POST)]
File "anymail/webhooks/mailgun.py", line 91, in esp_to_anymail_event
mta_status = int(esp_event['code'])
This might be a mailgun bug as well :)
The text was updated successfully, but these errors were encountered:
Hmm, Mailgun's event code has always been documented to be x.y.z, but in actual testing had been a three-digit integer. Looks like Mailgun's implementation finally caught up to their docs. (The raw_event data in Anymail's test_mailgun_webhooks was all derived from actual webhook events.)
I'll need to repeat some live testing to see what they're actually sending now for various bounce/failure event codes.
I've been trying to replicate this, and it seems like--despite Mailgun's docs--the three-digit integer error codes are also still common. (Both in their webhook test posts and from sends to several ISPs.)
Given the following
esp_event
from a Mailgun webhook:esp_to_anymail_event
fails with aValueError
trying to turn '5.1.1' into an int.Stacktrace:
This might be a mailgun bug as well :)
The text was updated successfully, but these errors were encountered: