diff --git a/build.sh b/build.sh index 51066c52..0a66f255 100755 --- a/build.sh +++ b/build.sh @@ -7,12 +7,13 @@ set -u if [[ ${TRAVIS_PYTHON_VERSION} == 2.7* ]]; then nosetests --with-coverage --cover-package=flanker else - nosetests --with-coverage --cover-package=flanker tests/mime/bounce_tests.py - nosetests --with-coverage --cover-package=flanker tests/mime/message/threading_test.py - nosetests --with-coverage --cover-package=flanker tests/mime/message/tokenizer_test.py - nosetests --with-coverage --cover-package=flanker tests/mime/message/headers/encodedword_test.py - nosetests --with-coverage --cover-package=flanker tests/mime/message/headers/headers_test.py - nosetests --with-coverage --cover-package=flanker tests/mime/message/headers/parametrized_test.py - nosetests --with-coverage --cover-package=flanker tests/mime/message/headers/parsing_test.py - nosetests --with-coverage --cover-package=flanker tests/mime/message/headers/wrappers_test.py + nosetests --with-coverage --cover-package=flanker \ + tests/mime/bounce_tests.py \ + tests/mime/message/threading_test.py \ + tests/mime/message/tokenizer_test.py \ + tests/mime/message/headers/encodedword_test.py \ + tests/mime/message/headers/headers_test.py \ + tests/mime/message/headers/parametrized_test.py \ + tests/mime/message/headers/parsing_test.py \ + tests/mime/message/headers/wrappers_test.py fi diff --git a/flanker/mime/bounce.py b/flanker/mime/bounce.py index 05259c3d..e3bdc7e4 100644 --- a/flanker/mime/bounce.py +++ b/flanker/mime/bounce.py @@ -1,78 +1,77 @@ from collections import deque from contextlib import closing +import attr import regex as re import six +from attr.validators import instance_of from six.moves import range from flanker.mime.message.headers import MimeHeaders from flanker.mime.message.headers.parsing import parse_stream +_HEADERS = ('Action', + 'Content-Description', + 'Diagnostic-Code', + 'Final-Recipient', + 'Received', + 'Remote-Mta', + 'Reporting-Mta', + 'Status') + +_RE_STATUS = re.compile(r'\d\.\d+\.\d+', re.IGNORECASE) + + +@attr.s(frozen=True) +class Result(object): + score = attr.ib(validator=instance_of(float)) + status = attr.ib(validator=instance_of(six.text_type)) + diagnostic_code = attr.ib(validator=instance_of(six.text_type)) + notification = attr.ib(validator=instance_of(six.text_type)) + + def detect(message): - headers = collect(message) - return Result( - score=len(headers) / float(len(HEADERS)), - status=get_status(headers), - notification=get_notification(message), - diagnostic_code=headers.get('Diagnostic-Code')) + headers = _collect_headers(message) + return Result(score=len(headers) / float(len(_HEADERS)), + status=_get_status(headers), + diagnostic_code=headers.get('Diagnostic-Code', u''), + notification=_get_notification(message)) -def collect(message): +def _collect_headers(message): collected = deque() for p in message.walk(with_self=True): - for h in HEADERS: + for h in _HEADERS: if h in p.headers: collected.append((h, p.headers[h])) if p.content_type.is_delivery_status(): - collected += collect_from_status(p.body) + collected += _collect_headers_from_status(p.body) + return MimeHeaders(collected) -def collect_from_status(body): +def _collect_headers_from_status(body): out = deque() with closing(six.StringIO(body)) as stream: for i in range(3): out += parse_stream(stream) + return out -def get_status(headers): +def _get_status(headers): for v in headers.getall('Status'): - if RE_STATUS.match(v.strip()): + if _RE_STATUS.match(v.strip()): return v + return u'' -def get_notification(message): + +def _get_notification(message): for part in message.walk(): content_desc = part.headers.get('Content-Description', '').lower() if content_desc == 'notification': return part.body - return None - - -HEADERS = ('Action', - 'Content-Description', - 'Diagnostic-Code', - 'Final-Recipient', - 'Received', - 'Remote-Mta', - 'Reporting-Mta', - 'Status') - -RE_STATUS = re.compile(r'\d\.\d+\.\d+', re.IGNORECASE) - - -class Result(object): - def __init__(self, score, status, notification, diagnostic_code): - self.score = score - self.status = status - self.notification = notification - self.diagnostic_code = diagnostic_code - - def __repr__(self): - return (u'bounce.Result(status={}, score={}, notification={},' - u' diag_code={})'.format(self.status, self.score, - self.notification, - self.diagnostic_code)) + return u'' diff --git a/flanker/mime/message/headers/parsing.py b/flanker/mime/message/headers/parsing.py index 699c4c77..0f9ab2b8 100644 --- a/flanker/mime/message/headers/parsing.py +++ b/flanker/mime/message/headers/parsing.py @@ -30,7 +30,7 @@ def parse_header(header): """ name, val = _split_header(header) if not is_pure_ascii(name): - raise DecodingError("Non-ascii header name") + raise DecodingError('Non-ascii header name') return name, parse_header_value(name, encodedword.unfold(val)) @@ -38,7 +38,7 @@ def parse_header(header): def parse_header_value(name, val): if not is_pure_ascii(val): if parametrized.is_parametrized(name, val): - raise DecodingError("Unsupported value in content- header") + raise DecodingError('Unsupported value in content- header') return to_unicode(val) @@ -62,7 +62,7 @@ def _read_header_lines(fp): lines = deque() for line in fp: if len(line) > _MAX_LINE_LENGTH: - raise DecodingError("Line is too long: %d" % len(line)) + raise DecodingError('Line is too long: %d' % len(line)) if is_empty(line): break diff --git a/flanker/mime/message/part.py b/flanker/mime/message/part.py index 5ddf80f7..4a0ace95 100644 --- a/flanker/mime/message/part.py +++ b/flanker/mime/message/part.py @@ -367,16 +367,7 @@ def remove_headers(self, *header_names): @property def bounce(self): """ - If the message is NOT bounce, then `None` is returned. Otherwise - it returns a bounce object that provides the values: - * score - a value between 0 and 1, where 0 means that the message is - definitely not a bounce, and 1 means that is definitely a - bounce; - * status - delivery status; - * notification - human readable description; - * diagnostic_code - smtp diagnostic codes; - - Can raise MimeError in case if MIME is screwed. + Deprecated: use bounce.detect(message). """ if not self._bounce: self._bounce = bounce.detect(self) @@ -384,8 +375,7 @@ def bounce(self): def is_bounce(self, probability=0.3): """ - Determines whether the message is a bounce message based on - given probability. 0.3 is a good conservative base. + Deprecated: use bounce.detect(message). """ return self.bounce.score > probability diff --git a/setup.py b/setup.py index d2ba89f4..8c370dde 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup(name='flanker', - version='0.7.4', + version='0.8.0', description='Mailgun Parsing Tools', long_description=open('README.rst').read(), classifiers=[], diff --git a/tests/__init__.py b/tests/__init__.py index 2a71ac4c..fa42c0a5 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -28,6 +28,7 @@ def read_fixture_bytes(path): # mime fixture files BOUNCE = read_fixture_bytes('messages/bounce/zed.eml') +BOUNCE_OFFICE365 = read_fixture_bytes('messages/bounce/office365.eml') MAILBOX_FULL = read_fixture_bytes('messages/bounce/mailbox-full.eml') NDN = read_fixture_bytes('messages/bounce/delayed.eml') NDN_BROKEN = read_fixture_bytes('messages/bounce/delayed-broken.eml') diff --git a/tests/fixtures/messages/bounce/office365.eml b/tests/fixtures/messages/bounce/office365.eml new file mode 100644 index 00000000..25ea5873 --- /dev/null +++ b/tests/fixtures/messages/bounce/office365.eml @@ -0,0 +1,1131 @@ +X-Mailgun-Spam-Rules: DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, MIME_HTML_MOSTLY, + NORMAL_HTTP_TO_IP, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, URIBL_BLOCKED +X-Mailgun-Dkim-Check-Result: Pass +X-Mailgun-Spf: Pass +X-Mailgun-Sscore: 0.0 +X-Mailgun-Sflag: No +X-Mailgun-Incoming: Yes +Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01hn0223.outbound.protection.outlook.com [104.47.0.223]) + by mxa.mailgun.org with ESMTP id 59e09f1b.7f31e76958c8-api-01; + Fri, 13 Oct 2017 11:10:19 -0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=examplenorge.onmicrosoft.com; s=selector1-example-no; + h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; + bh=yfKQqTOooDdyliev9ug3fBSp+NC30VUAr9xUChswGoA=; + b=WXYHRzffqy5frife0kpHVfaioykHNwOHg8VJBjAr3bhVDId7gsF+xhs/2Ksq+UuvxiDItaI2ui7UbXXzBgDkzj+ZC+W7PYG7+QLbfz4mCFAszQMWVGQPRd00eBbjO1iiAiYkDpqgkV56l16mWXXQBAxj+vbcUCOVQie+5xfNuUk= +MIME-Version: 1.0 +From: +To: +Date: Fri, 13 Oct 2017 11:10:16 +0000 +Content-Type: multipart/report; report-type=delivery-status; + boundary="22a54575-c842-43f3-83ea-721e8360fb4c" +X-MS-Exchange-Message-Is-Ndr: +Content-Language: en-US +Message-ID: <2ab24bbc-78da-492a-9f68-438ddae558bb@DB5PR06MB1800.eurprd06.prod.outlook.com> +In-Reply-To: <20171013111011.20866.254C2F3A4D7AA526@ninomail.com> +References: <20171013111011.20866.254C2F3A4D7AA526@ninomail.com> +Subject: Undeliverable: test_bounce 8 +Auto-Submitted: auto-replied +X-MS-PublicTrafficType: Email +X-MS-TrafficTypeDiagnostic: DB5PR06MB1800: +X-MS-Office365-Filtering-Correlation-Id: 8f2b4ff8-a8f6-40e6-0fa5-08d5122afbe8 +X-Microsoft-Exchange-Diagnostics: + 1;DB5PR06MB1800;25:dMcqypSP9k67Vv9AKu6Pato55s5v3lUXrpLyU8u4hWzTnwKnBRDff/vPF9U8fGfY5E1GRFiBEovEBfnyO0FbTBKJCtlKrhryFueZxIWnzEIrJ2ji9HrRdjdOUYxoO8+odX2du1LqIR3f7fG2uamJBr+HmzpOmO9pSq4YpYvcUq73N3zjW4FiNkfn2c1mmPjI3jcMXYUocSxkT+agiuYB5Tfqd1hYrk/1/eiP902SZMXhoudaQswkWQlyLmlpiSnIEbP9B4Wao5Qj5Nf12/M0cs9FR33dKZCOisj/XrrqMnrWSPqv+F25olMqNV24SvcO6sMQEMA+pY0dYcl9kyhKjbP/VA+nhjqSG/8UR91FY2s=;31:W9G1RkrlGHV5c7LbK0vfBCGvKc4BtpWyeLX3Rg/UIFkfyz+I9w13pUJ/4Aao0Jgt6WWHvGwbpLc/JMLWpII/CZto0A815LAwSSWIUJUZd5Cd7+W987Kz3shHoP7dVdT6ymUzGspCT9bqfvRClBZ3oO3SP0dl+Bup+YXdvGj4s+rUQoPRFbjtnVSshbxfAt2TOPbucMrsKxw3gWGk5NXMPWjmaQGwqyUS38IzI0W4C/I= +X-Exchange-Antispam-Report-Test: + UriScan:(158342451672863)(156600954879566)(160011542660777)(189930954265078)(215449377671575)(266611908612381)(266651597892604)(277809949798613)(112002664235607)(136887953259498); +X-Microsoft-Antispam-PRVS: + +X-Exchange-Antispam-Report-CFA-Test: + BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(102415395)(53401082)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(100000703101)(100105400095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061750153)(20161123558100)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(53402082)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB5PR06MB1800;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB5PR06MB1800; +X-Microsoft-Exchange-Diagnostics: + 1;DB5PR06MB1800;4:/GAkPwE/Z8lSgDwBKM/VkYfWm3iU12GDBfzKJbpnmPnk/v2aiy2lUbs1S5+epLQXgEgv3YkCG6khbyiOXy9KDrvjNbJk4oW2IelmqjP3R0JKhl/Yw8ycw0Y7lkibI5NlUyXND5UqMXbF8gT0FYlDYUOMtYaHPYCELoHZo06Rtipazc8YZC7qVdJ1uFipZwaEvTf7fplFXN/lSJR1eE42uZnz6leH2bvAd3D0JS4o3QjmAdwbt6MqpEzPEAVPmKWMzsYifYaKHLD2lN3kFMMYhQKCbdZJUyX9NR8YCfX9QsHjQhEImH047bKlH1VF7V+9K/jwNvEjRszt3Gwa6aE2KVHIGU/uYcCA4p/m3UUzjd6gWuV1vZK9ZxfXNzxrmpULX7y03FSmOqwgyuShyBbEkEaKCM0AOtR9yAjTRbMcvyQjXBy5/kj5/PYSRaws8x3edOsVRH45qmLRPP1FWV6CG5Uw0hCFwxM70BKyeHZbl0auDcjpQe4nWjFenazpbEBYqABHsZoL6j+pm54lVFpMoq9qHRyJx4UcD06BqsQnXwvfdIPRbsEu+fnJ3kmletPi+VdoiZ2teK/B/Fa4wIWk0iO0WHVyXV6gmE2mDLxQXiQ= +X-Forefront-PRVS: 04599F3534 +X-Forefront-Antispam-Report: + SFV:NSPM;SFS:(10009020)(50650200002)(4640300001)(4630300001)(376002)(346002)(199003)(189002)(377454003)(3905003)(1930700014)(319900001)(16586007)(42186006)(316002)(2906002)(97736004)(5660300001)(45080400002)(498600001)(9686003)(236005)(6306002)(86152003)(7350300001)(53946003)(53936002)(189998001)(606006)(74316002)(78352004)(2876002)(11286001)(84326002)(8676002)(733005)(68736007)(81156014)(81166006)(5320300001)(1706002)(33646002)(5008980100002)(31696002)(512954002)(74482002)(101416001)(83832001)(102106001)(54356999)(1476001)(50986999)(76176999)(260700001)(106356001)(2351001)(10126004)(89962001)(42882006)(6916009)(1496007)(2950100002)(105586002)(575784001)(82146005)(3720700003)(579004)(19627235001);DIR:OUT;SFP:1501;SCL:1;SRVR:DB5PR06MB1800;H:;FPR:;SPF:None;PTR:InfoNoRecords;A:0;MX:0;LANG:en; +Received-SPF: None (protection.outlook.com: does not designate permitted + sender hosts) +Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; +X-Microsoft-Exchange-Diagnostics: + =?us-ascii?Q?1;DB5PR06MB1800;23:NjCK8s1zUT02wQGsJ2CdrbnwabySfTUX9zMn9i2lZ?= + =?us-ascii?Q?86er+5SHclSExb2PnSrjS+yW8Gs/0X85glw6Y6Q5DkAW6Gi0D96A8DxN2iu9?= + =?us-ascii?Q?QWpqVv/rLyoD2d3bC/bHOp7nX7gn0SaKES1TjmhcIYC8F4RWMu6MYo+5SJll?= + =?us-ascii?Q?bZNSQ4bDUeFPeK2g5pBVKsQGUqAtbTfl+pfzoXXQ0U1COIoFzu/hs6AG0UZC?= + =?us-ascii?Q?E8iolX+9pbs4YAEjBBVQL6doPrWd2jTW7c7og/SOMWK2BEJrOmlZNxzFZOYE?= + =?us-ascii?Q?ve74Y2owHpBKLsFFrkiw5jwv9UnEZUMiu0C/AKhVgAXXe5JxI8ojj7T48Gwh?= + =?us-ascii?Q?tDmZ1qqHmRwxHLt3tAhQ/DdaoPd8omFClM+wfYGChbkP82+2kYkWvAnzfqv9?= + =?us-ascii?Q?FkpiyZNBJTZ3ew7WT2KwnhSmVjLuxyIakTLGKqSt5UZ5qm/8xxlQQCH58stT?= + =?us-ascii?Q?oAdjwQMMp1zPu0ylztApEGU64jKZBr/qIWO4Rebso18y4zjGgbeloDRjpSHO?= + =?us-ascii?Q?K9dDyt1FCAULb+XZrO/kaWSzh+1FdCF36yCp4WlikQXif/D5CvDte9vibzyG?= + =?us-ascii?Q?zzeHKpx3XwTAl15BNDo2LKrV9IyLBFe6F4paInWwLHqgpx1jZbH6Tg6XFKPW?= + =?us-ascii?Q?C3/6InuaDk7nrF+DJq4cr25k4ZtdYj6kACz4Ej4GcP4IPJwSQ2fvisdAYZbN?= + =?us-ascii?Q?i1bbiuo+/20FnJ7FnIXJGdaFf20O+rj77qAvBivSdZXgTvNBw3CBCat4lfHX?= + =?us-ascii?Q?8KZ/LYP2iUsLBHVObn+3Z6F140PFZqhm453Z3J99tu0g/1uBJswN77w+aJWo?= + =?us-ascii?Q?laZjfiWFhySKAOORGOlL7lh3EPfym3tuKt8DIYM0rZ1hVGliXF8HRwgfentW?= + =?us-ascii?Q?Ae3GOhP0+ZXxY9jFrL7lJOWGMybCPtr4LKI8BFuxDp1QZJYkWevk401l4r6e?= + =?us-ascii?Q?93YMbj4Nk+yP/iS6DFHpTsMTHleWCD3Dgv13sjvF1Yp3Me01H5a0pbwN+deZ?= + =?us-ascii?Q?gSR0pocyfg0DJ2El54bCBtavOPU3L2sZzdS1qQhI9uXsa4B9z2aCzFwuimrS?= + =?us-ascii?Q?gnQ1hRzzxpTiI75k/ou3lIFQMbvVAMa0QnVzijZTxSISOREOU1KqNnL2i5lY?= + =?us-ascii?Q?uV6POv/NSvQozxQeO2JoJWE/7nxF9X/32GYP/+KCwz9sPSPs9pixwAVPJH7s?= + =?us-ascii?Q?kxGcagmSMiOrhDtJ5tfMVRDWG4dFDkcuN71wzjsJLF7J3s4Vu0sML8hQMSh1?= + =?us-ascii?Q?ydYuZmstoDhfrdNqtVuLBsM+6El8LS4XeG8BNCnwJadVhB2TLbX14ZgURuN3?= + =?us-ascii?Q?RrACGX8UVch3hA2P5U/QP1BZQz9sNv3F1c6Sc39FNIx2SkIk/F+ZxDAjZxyC?= + =?us-ascii?Q?01OWBjYKg7AHNivIVGlNNKlkJnA/q0M38cYKWPbzqbohonYw3ykSfOes+0m2?= + =?us-ascii?Q?Y7qoe9vwAle1k/cGKa7CQPNcH0CeR1hZgiT20D28ZMiSEwbApmuf7996u2lR?= + =?us-ascii?Q?KWcZ5OffrYgjpgGHzCLtTRCqF1FP/ochWGwETch/2DY7IsTfr7Zqk8PjKQwN?= + =?us-ascii?Q?MDe0bMb7XWcPPcG0/kAACamE1jzAW4aeou4RWI=3D?= +X-Microsoft-Exchange-Diagnostics: + 1;DB5PR06MB1800;6:UaLMB0qJyr3zR8wh/QFuB9Y1bQGWnBztVxtTw5Ww4qXFRaJDg/UsS/DhnON704Il6UQw2vi4qp5HILO3WQ4YF0EA+0kxI83OhIetEr4a9ob5jObSzrl/+vCkdKQkZ2ca4idTeFK7vkF8eqM5Rf9PQBIwhf4cWyHKjZ/LfiSt7T6WI++wQk4hFYKnwrJl14zR86JIqrpsdRyQA5gpkUqTgJ+klNvsEodhymKBTy15AEBHcISlmLJTl+hb4V0EdVttetw3t8oFqFJBSlVki/MdzUbB/I7Uz59nWDuOzXzvJMs6fRDAY9IfjXfbgd5iUdI7zZEzPVXSXFq2o8uqqt9ukg==;5:ISdbKPzzVo1/3SyCacWn4MXOrU4xmxaK+owU9N6AXTJfsu3jG21tv8sazHSE/n4hQhy1Jz6DoaZHNwUiY6IipJA1R54m+T08yxIBb/r12kjxAKELDOjpo8tzpi+mVq2fuPuMuhgvspLI2OoNZxF0ZA==;24:7jy/Z5IExXmvKPYun/2CEaiju2Mv9vefX3ypT3Dvw8SxuIQdViG/Y2gi6XMwYx2P5g5AgxMHk5IPwJxz53/CQS3UFzEtLu2ORDYbluSV9gE=;7:i78UKyffWC46GFNc3r9dRXlZwZn4uoZ3JdMBrH8nY64Of9nputUFhe2ihXO+sF8t6+aK8oFJFGLtUz3ShHbmE44CCfG/9UHRP7+zLqPbDfTX9vwrjmW235qRIx376Uf4Rs8gFbHrzHHqm3uFvPSfRZzGS++hMJ1CuT2zykEeYYHQupRzM0soNcZZROez3OFd0+5XdXWiFsqOTOPplXac3OeLgjo/+r6b0XlDwms1KKg= +SpamDiagnosticOutput: 1:99 +SpamDiagnosticMetadata: NSPM +X-OriginatorOrg: example.no +X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2017 11:10:16.7009 + (UTC) +X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted +X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR06MB1800 + +--22a54575-c842-43f3-83ea-721e8360fb4c +Content-Type: multipart/alternative; differences=Content-Type; + boundary="75454191-d3d5-48ec-b8f1-8aa1d75d02e4" + +--75454191-d3d5-48ec-b8f1-8aa1d75d02e4 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +[http://products.office.com/en-us/CMSImages/Office365Logo_Orange.png?versio= +n=3Db8d100a9-0a8b-8e6a-88e1-ef488fee0470] +Your message to noname@example.com couldn't be delivered. + +noname wasn't found at example.com. + +postmaster Office 365 noname +Action Required Recipient + + +Unknown To address + + +How to Fix It +The address may be misspelled or may not exist. Try one or more of the foll= +owing: + + * Send the message again following these steps: In Outlook, open this n= +on-delivery report (NDR) and choose Send Again from the Report ribbon. In O= +utlook on the web, select this NDR, then select the link "To send this mess= +age again, click here." Then delete and retype the entire recipient address= +. If prompted with an Auto-Complete List suggestion don't select it. After = +typing the complete address, click Send. + * Contact the recipient (by phone, for example) to check that the addre= +ss exists and is correct. + * The recipient may have set up email forwarding to an incorrect addres= +s. Ask them to check that any forwarding they've set up is working correctl= +y. + * Clear the recipient Auto-Complete List in Outlook or Outlook on the w= +eb by following the steps in this article: Fix email delivery issues for er= +ror code 5.1.10 in Office 365, and then send the message again. Retype the entire recipient address b= +efore selecting Send. + + +If the problem continues, forward this message to your email admin. If you'= +re an email admin, refer to the More Info for Email Admins section below. + + +Was this helpful? Send feedback to Microsoft. +________________________________ + + +More Info for Email Admins +Status code: 550 5.1.10 + +This error occurs because the sender sent a message to an email address hos= +ted by Office 365 but the address is incorrect or doesn't exist at the dest= +ination domain. The error is reported by the recipient domain's email serve= +r, but most often it must be fixed by the person who sent the message. If t= +he steps in the How to Fix It section above don't fix the problem, and you'= +re the email admin for the recipient, try one or more of the following: + +The email address exists and is correct - Confirm that the recipient addres= +s exists, is correct, and is accepting messages. + +Synchronize your directories - If you have a hybrid environment and are usi= +ng directory synchronization make sure the recipient's email address is syn= +ced correctly in both Office 365 and in your on-premises directory. + +Errant forwarding rule - Check for forwarding rules that aren't behaving as= + expected. Forwarding can be set up by an admin via mail flow rules or mail= +box forwarding address settings, or by the recipient via the Inbox Rules fe= +ature. + +Recipient has a valid license - Make sure the recipient has an Office 365 l= +icense assigned to them. The recipient's email admin can use the Office 365= + admin center to assign a license (Users > Active Users > select the recipi= +ent > Assigned License > Edit). + +Mail flow settings and MX records are not correct - Misconfigured mail flow= + or MX record settings can cause this error. Check your Office 365 mail flo= +w settings to make sure your domain and any mail flow connectors are set up= + correctly. Also, work with your domain registrar to make sure the MX recor= +ds for your domain are configured correctly. + +For more information and additional tips to fix this issue, see Fix email d= +elivery issues for error code 5.1.10 in Office 365. + + +Original Message Details +Created Date: 10/13/2017 11:10:12 AM +Sender Address: postmaster@ninomail.com +Recipient Address: noname@example.com +Subject: test_bounce 8 + + +Error Details +Reported error: 550 5.1.10 RESOLVER.ADR.RecipientNotFound; Recipient noname= +@example.com not found by SMTP address lookup +DSN generated by: DB5PR06MB1800.eurprd06.prod.outlook.com + + +Message Hops +HOP TIME (UTC) FROM TO WITH RELAY TIME +1 10/13/2017 +11:10:11 AM luna.mailgun.net HTTP * +2 10/13/2017 +11:10:13 AM dfw-p103.ninomail.com inpreemea2.hes.trendmicro.eu ESM= +TPS 2 sec +3 10/13/2017 +11:10:14 AM 209.61.154.103_hes.trendmicro.com ioutemea3.hes.trend= +micro.eu SMTP 1 sec +4 10/13/2017 +11:10:14 AM ioutemea3.hes.trendmicro.eu HE1EUR01FT040.mail.protecti= +on.outlook.com Microsoft SMTP Server (version=3DTLS1_2, cipher=3DTLS_= +ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) * +5 10/13/2017 +11:10:15 AM HE1EUR01FT040.eop-EUR01.prod.protection.outlook.com VI1= +PR0601CA0032.outlook.office365.com Microsoft SMTP Server (version=3DTLS1_= +2, cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) 1 sec +6 10/13/2017 +11:10:16 AM VI1PR0601CA0032.eurprd06.prod.outlook.com DB5PR06MB18= +00.eurprd06.prod.outlook.com Microsoft SMTP Server (version=3DTLS1_2, ciphe= +r=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) 1 sec + +Original Message Headers + +Received: from VI1PR0601CA0032.eurprd06.prod.outlook.com + (2603:10a6:800:1e::42) by DB5PR06MB1800.eurprd06.prod.outlook.com + (2a01:111:e400:7905::18) with Microsoft SMTP Server (version=3DTLS1_2, + cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 1= +3 Oct + 2017 11:10:16 +0000 +Received: from HE1EUR01FT040.eop-EUR01.prod.protection.outlook.com + (2a01:111:f400:7e1f::206) by VI1PR0601CA0032.outlook.office365.com + (2603:10a6:800:1e::42) with Microsoft SMTP Server (version=3DTLS1_2, + cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Fro= +ntend + Transport; Fri, 13 Oct 2017 11:10:15 +0000 +Authentication-Results: spf=3Dsoftfail (sender IP is 52.58.62.203) + smtp.mailfrom=3Dninomail.com; example.com; dkim=3Dpass (signature was + verified) header.d=3Dninomail.com;example.com; dmarc=3Dnone action=3Dn= +one + header.from=3Dmailgunhq.com; +Received-SPF: SoftFail (protection.outlook.com: domain of transitioning + ninomail.com discourages use of 52.58.62.203 as permitted sender) +Received: from ioutemea3.hes.trendmicro.eu (52.58.62.203) by + HE1EUR01FT040.mail.protection.outlook.com (10.152.1.72) with Microsoft SMT= +P + Server (version=3DTLS1_2, cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P= +384) id + 15.20.77.10 via Frontend Transport; Fri, 13 Oct 2017 11:10:14 +0000 +Received: from 209.61.154.103_hes.trendmicro.com (unknown [192.168.13.217]) + by ioutemea3.hes.trendmicro.eu (Postfix) with SMTP id 749FD11200E + for ; Fri, 13 Oct 2017 11:10:14 +0000 (UTC) +Received: from dfw-p103.ninomail.com (unknown [209.61.154.103]) + by inpreemea2.hes.trendmicro.eu (Postfix) with ESMTPS id 2D9022EE05= +E + for ; Fri, 13 Oct 2017 11:10:13 +0000 (UTC) +DKIM-Signature: a=3Drsa-sha256; v=3D1; c=3Drelaxed/relaxed; d=3Dninomail.co= +m; q=3Ddns/txt; s=3Dmx; + t=3D1507893012; h=3DContent-Transfer-Encoding: Mime-Version: Content-Type: + Subject: From: To: Message-Id: List-Unsubscribe: Date; + bh=3DZ0RRkWGMZ95HQdCnkNkIEgrcz3FH2ScG0r54JXFR3Vw=3D; b=3DArQ3Q8lB0KCJxNGU0= +uwQe8mnOWDTlOi+T0lie9zlMs/kk7xgbuJBtt0xfE40o/gIlYENQ5VV + yrubfcZ0JTnszpw2QJVLJs/ETig+ZA10qRXR7P+EwzbyCI7XEneMrcwQsBFbrDBHiMVsPCws + 6Sppee8wcuTNbWfkdOhbY8xpQ/o=3D +DomainKey-Signature: a=3Drsa-sha1; c=3Dnofws; d=3Dninomail.com; s=3Dmx; q= +=3Ddns; + h=3DDate: List-Unsubscribe: Message-Id: To: From: Subject: Content-Type: + Mime-Version: Content-Transfer-Encoding; + b=3DkeeX65FWYAvnsAB/PT4Bwv5z2gZlber/+lccOi3sEbbWy+dBP58bVTxMju9kTjV5FR8Nix + ePnEngG56ziSjkEXiPLI2bIfLYZf0sByiB4giyTlejQW4su2ymBVfIX0pj/P9TT/Hk24ZtPF + DFQfd2DXdV+ssayd7A0boyiqyrrOk=3D +Date: Fri, 13 Oct 2017 11:10:12 +0000 +X-Mailgun-Sending-Ip: 209.61.154.103 +X-Mailgun-Sid: WyJlYjg3MCIsICJob3JraGVAc3VwZXJvZmZpY2UuY29tIiwgIjYiXQ=3D=3D +List-Unsubscribe: +Received: by luna.mailgun.net with HTTP; Fri, 13 Oct 2017 11:10:11 +0000 +Message-ID: <20171013111011.20866.254C2F3A4D7AA526@ninomail.com> +X-Mailgun-Native-Send: yes +To: noname@example.com +From: noname@mailgunhq.com +Subject: test_bounce 8 +Content-Type: text/plain; charset=3D"ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-TM-Received-SPF: Pass (domain of postmaster@ninomail.com designates + 209.61.154.103 as permitted sender) client-ip=3D209.61.154.103; + envelope-from=3Dpostmaster@ninomail.com; helo=3Ddfw-p103.ninomail.c= +om +X-TMASE-Version: StarCloud-1.3-8.2.1006-23392.006 +X-TMASE-Result: 10--2.729200-10.000000 +X-TMASE-MatchedRID: GooOU10L43zav6YmtDxNqNFig1NpvMlDPuK6nXzgR1TnBDF/TMnTXjJ= +l + 3MhaKU4m4vM1YF6AJbaKoonP3ywz3Y4dBcJ6M5YH0ddkKKNSSi9XH0VVrOHyJe2tcfd= +uZIOv3Qf + wsVk0UbtQ1faGnRfEeCS6ICxj5PROYkrzZvAd3CfT4GfHkFXnynlApuqqC+djwaBvbB= +px3eXfDq + qb3XQ/hue1U/Euj8bPgviCrXu93JNzjSufs2oTAvK4cKjK2vlq8OTZexKs73Ol3wq8b= +Gz2prEkr + SbZSQWFUBAqBajX2hg=3D +X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0,39:0-0 +X-TM-Deliver-Signature: A1F966477493E8CC077EFBFD2963EE52 +Return-Path: postmaster@ninomail.com +X-EOPAttributedMessage: 0 +X-EOPTenantAttributedMessage: caef7785-c073-4453-8b47-6432b6b5b10f:0 +X-Forefront-Antispam-Report: CIP:52.58.62.203;IPV:NLI;CTRY:US;EFV:NLI; +X-Microsoft-Exchange-Diagnostics: 1;HE1EUR01FT040;1:8Yfy3RCcMtWjd2wHETuKGgb= +YvMhwEmz4LIe9f7oSB4tp7h0z7cACxryH+0M3NT8qJ2/j7nTdwkEifFRCFkEmVm/8U0MfnxdPin= +eDdDC5D9GGTRKhxkl4L+aROlRj/J3a +X-MS-PublicTrafficType: Email +X-MS-Office365-Filtering-Correlation-Id: c68ecd6c-bb49-4ed3-2782-08d5122afa= +fa +X-DkimResult-Test: Passed +X-Microsoft-Antispam: + UriScan:;BCL:0;PCL:0;RULEID:(22001)(23075)(421252002)(3001016)(7170= +2078);SRVR:DB5PR06MB1800; +X-Microsoft-Exchange-Diagnostics: + 1;DB5PR06MB1800;3:eIUBG2d+QhGEssrKUk0vR7Qo1xBaLzxFYKXinPbtC3lbNOOKl= +0ptZ6Dwpd5/OvUk0hZRjDmU0H0A+3+cYAwCf+XK0aF+w/f/0BM1HB6RqZvKasYY4skANmQh1SUI= +E3/NlmmfNUCPAXe2mYko5gjHS3FWfNfn5JUpUc0uqi1CiQZuz75UkMI1StjnNztymn4Poa04bv3= +29Q323gfsNJDTRWxvCNmrgSBqavZ85LE43+/3tXAXH25lu0HWaLJbf+P7M91/9m1dGEE3lE9BSH= +AgsW5mxY0Rgk9Cfi44Cz2zJn1W5JH5LJ2aR7fnETCIBMSnTmU9lskn5OxBoBsug3J1sg=3D=3D;= +25:QhToXBW84g8b1E0tDQz1wlgKZHT3MfBBXPqER0vHXiVfl5tgVG8PQ9vjAYKosqQIh25bjvo5= +I/HrmLe8XFOg6bYQI/VrzqPSE6wBZTZ+nZ8dFdyWwRSbX85RKC9pm62yFaIbsOkta1xF/q8CE5n= +yFkKfUxHt9vHosW4IrzT7+w8XAhh0VqhUYOvk4Cp1St3M8L8GAu90Dj3kaupTwZhxUxVkYVewyc= +8xb74anpZIASat5MjRVcVH26j5EUwN24Ko1RUunp7SXLydpXqJKUJcxjbJe6absxj+5Fb2GzCQh= ++k/9quBIDXusyO9MsAorZoZMVUVl/pmy/6V/KYy9AfpsAgvXvZoa31ftGl2wTt6t3k=3D +X-MS-TrafficTypeDiagnostic: DB5PR06MB1800: + + +--75454191-d3d5-48ec-b8f1-8aa1d75d02e4 +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + DSN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
Your message to noname@example.com c= +ouldn't be delivered.
+ noname was= +n't found at example.com<= +/span>.
+ + + + + + + + + + + + + + + + + + +
+ + postmaster + + + + Office 365 + + + + noname + +
+ + + Action Required + + + + + + Recipient + +
+ + + + + + + + + + +
+
+ + Unknown= + To address + + + +
+
+
+ + + + + + + + + + + + + + + +
How to Fix It
The address may be misspelled or may not exist. T= +ry one or more of the following:
+
    +
  • Send the message again following these steps: In = +Outlook, open this non-delivery report (NDR) and choose Send Again f= +rom the Report ribbon. In Outlook on the web, select this NDR, then select = +the link "To send this message again, click here." Then delete and r= +etype the entire recipient address. If prompted with an Auto-Complete List = +suggestion don't select it. After typing the complete address, click Sen= +d.
  • +
  • Contact the recipient (by phone, for example) to = +check that the address exists and is correct.
  • +
  • The recipient may have set up email forwarding to= + an incorrect address. Ask them to check that any forwarding they've set up= + is working correctly.
  • +
  • Clear the recipient Auto-Complete List in Outlook= + or Outlook on the web by following the steps in this article: Fix email delivery issues f= +or error code 5.1.10 in Office 365, and then send the message again. Re= +type the entire recipient address before selecting Send.
  • +
+
If the problem continues, forward this message to= + your email admin. If you're an email admin, refer to the More Info for = +Email Admins section below.
+
+
+ Was this helpful? Send feedback to Microsoft. +
+
+
+
More Info for Email Admins
+ Status code: 550 5.1.10 +
+
This error occurs because the sender sent a message to an= + email address hosted by Office 365 but the address is incorrect or doesn't= + exist at the destination domain. The error is reported by the recipient do= +main's email server, but most often it must be fixed by the person who sent= + the message. If the steps in the How to Fix It section above don't = +fix the problem, and you're the email admin for the recipient, try one or m= +ore of the following:

The email address exists and is correct= + - Confirm that the recipient address exists, is correct, and is accept= +ing messages.

Synchronize your directories - If you have = +a hybrid environment and are using directory synchronization make sure the = +recipient's email address is synced correctly in both Office 365 and in you= +r on-premises directory.

Errant forwarding rule - Check f= +or forwarding rules that aren't behaving as expected. Forwarding can be set= + up by an admin via mail flow rules or mailbox forwarding address settings,= + or by the recipient via the Inbox Rules feature.

Recipient h= +as a valid license - Make sure the recipient has an Office 365 license = +assigned to them. The recipient's email admin can use the Office 365 admin = +center to assign a license (Users > Active Users > select the recipie= +nt > Assigned License > Edit).

Mail flow settings and M= +X records are not correct - Misconfigured mail flow or MX record settin= +gs can cause this error. Check your Office 365 mail flow settings to make s= +ure your domain and any mail flow connectors are set up correctly. Also, wo= +rk with your domain registrar to make sure the MX records for your domain a= +re configured correctly.

For more information and additional tip= +s to fix this issue, see Fix email delivery issues for error code 5.1.10 in Office 365.

Original Message Details
+ + + + + + + + + + + + + + + + + + + +
Created Date:10/13/2017 11:10:12 AM
Sender Address:postmaster@ninomail.com
Recipient Address:noname@example.com
Subject:test_bounce 8
+
+
Error Details
+ + + + + + + + + + +
Reported error: + 550 5.1.10 RESOLVER.ADR.RecipientNotFound; Recipien= +t noname@example.com not found by SMTP address lookup +
DSN generated by:DB5PR06MB1800.eurprd06.prod.outlook.com +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Message Hops
HO= +PTIME (UTC)FR= +OMTO= +WI= +THRE= +LAY TIME
110/13/2017
11:= +10:11 AM
luna.mailgun.netHTTP*
210/13/2017
11:= +10:13 AM
dfw-p103.ninomail.cominpreemea2.hes.trendmicro.euESMTPS2 sec
310/13/2017
11:= +10:14 AM
209.61.154.103_hes.trendmicro.comioutemea3.hes.trendmicro.euSMTP1 sec
410/13/2017
11:= +10:14 AM
ioutemea3.hes.trendmicro.euHE1EUR01FT040.mail.protection.outlook.c= +omMicrosoft SMTP Server (version=3DTLS1_2= +, cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384)*
510/13/2017
11:= +10:15 AM
HE1EUR01FT040.eop-EUR01.prod.protection= +.outlook.comVI1PR0601CA0032.outlook.office365.com + Microsoft SMTP Server (version=3DTLS1_2= +, cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256)1 sec
610/13/2017
11:= +10:16 AM
VI1PR0601CA0032.eurprd06.prod.outlook.c= +omDB5PR06MB1800.eurprd06.prod.outlook.com= +Microsoft SMTP Server (version=3DTLS1_2= +, cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256)1 sec
+

Original Message Headers

+
Received: from VI1PR0601CA0032.e=
+urprd06.prod.outlook.com
+ (2603:10a6:800:1e::42) by DB5PR06MB1800.eurprd06.prod.outlook.com
+ (2a01:111:e400:7905::18) with Microsoft SMTP Server (version=3DTLS1_2,
+ cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 1=
+3 Oct
+ 2017 11:10:16 +0000
+Received: from HE1EUR01FT040.eop-EUR01.prod.protection.outlook.com
+ (2a01:111:f400:7e1f::206) by VI1PR0601CA0032.outlook.office365.com
+ (2603:10a6:800:1e::42) with Microsoft SMTP Server (version=3DTLS1_2,
+ cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Fro=
+ntend
+ Transport; Fri, 13 Oct 2017 11:10:15 +0000
+Authentication-Results: spf=3Dsoftfail (sender IP is 52.58.62.203)
+ smtp.mailfrom=3Dninomail.com; example.com; dkim=3Dpass (signature was
+ verified) header.d=3Dninomail.com;example.com; dmarc=3Dnone action=3Dn=
+one
+ header.from=3Dmailgunhq.com;
+Received-SPF: SoftFail (protection.outlook.com: domain of transitioning
+ ninomail.com discourages use of 52.58.62.203 as permitted sender)
+Received: from ioutemea3.hes.trendmicro.eu (52.58.62.203) by
+ HE1EUR01FT040.mail.protection.outlook.com (10.152.1.72) with Microsoft SMT=
+P
+ Server (version=3DTLS1_2, cipher=3DTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P=
+384) id
+ 15.20.77.10 via Frontend Transport; Fri, 13 Oct 2017 11:10:14 +0000
+Received: from 209.61.154.103_hes.trendmicro.com (unknown [192.168.13.217])
+	by ioutemea3.hes.trendmicro.eu (Postfix) with SMTP id 749FD11200E
+	for <noname@example.com>; Fri, 13 Oct 2017 11:10:14 +0000 (UTC)
+Received: from dfw-p103.ninomail.com (unknown [209.61.154.103])
+	by inpreemea2.hes.trendmicro.eu (Postfix) with ESMTPS id 2D9022EE05E
+	for <noname@example.com>; Fri, 13 Oct 2017 11:10:13 +0000 (UTC)
+DKIM-Signature: a=3Drsa-sha256; v=3D1; c=3Drelaxed/relaxed; d=3Dninomail.co=
+m; q=3Ddns/txt; s=3Dmx;
+ t=3D1507893012; h=3DContent-Transfer-Encoding: Mime-Version: Content-Type:
+ Subject: From: To: Message-Id: List-Unsubscribe: Date;
+ bh=3DZ0RRkWGMZ95HQdCnkNkIEgrcz3FH2ScG0r54JXFR3Vw=3D; b=3DArQ3Q8lB0KCJxNGU0=
+uwQe8mnOWDTlOi+T0lie9zlMs/kk7xgbuJBtt0xfE40o/gIlYENQ5VV
+ yrubfcZ0JTnszpw2QJVLJs/ETig+ZA10qRXR7P+EwzbyCI7XEneMrcwQsBFbrDBHiMVsPCws
+ 6Sppee8wcuTNbWfkdOhbY8xpQ/o=3D
+DomainKey-Signature: a=3Drsa-sha1; c=3Dnofws; d=3Dninomail.com; s=3Dmx; q=
+=3Ddns;
+ h=3DDate: List-Unsubscribe: Message-Id: To: From: Subject: Content-Type:
+ Mime-Version: Content-Transfer-Encoding;
+ b=3DkeeX65FWYAvnsAB/PT4Bwv5z2gZlber/+lccOi3sEbbWy+dBP58bVTxMju9kTjV5FR8Nix
+ ePnEngG56ziSjkEXiPLI2bIfLYZf0sByiB4giyTlejQW4su2ymBVfIX0pj/P9TT/Hk24ZtPF
+ DFQfd2DXdV+ssayd7A0boyiqyrrOk=3D
+Date: Fri, 13 Oct 2017 11:10:12 +0000
+X-Mailgun-Sending-Ip: 209.61.154.103
+X-Mailgun-Sid: WyJlYjg3MCIsICJob3JraGVAc3VwZXJvZmZpY2UuY29tIiwgIjYiXQ=3D=3D
+List-Unsubscribe: <mailto:u+mq6tmjtjhuzdamjxgeydcmzrgeytamjrfyzdaobwgyxd=
+enjuimzemm2bgrcdoqkbguzdmjjugbxgs3tpnvqws3bomnxw2jtihu4gcnjxgjrgmzbtgu2wezr=
+vgazgeolemiydonbvgqzwiyjxmq3dojtshvug64tlnbssknbqon2xazlsn5tgm2ldmuxgg33nez=
+2d2jjsie@ninomail.com>
+Received: by luna.mailgun.net with HTTP; Fri, 13 Oct 2017 11:10:11 +0000
+Message-ID: <20171013111011.20866.254C2F3A4D7AA526@ninomail.com>
+X-Mailgun-Native-Send: yes
+To: noname@example.com
+From: noname@mailgunhq.com
+Subject: test_bounce 8
+Content-Type: text/plain; charset=3D"ascii"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-TM-Received-SPF: Pass (domain of postmaster@ninomail.com designates=20
+	209.61.154.103 as permitted sender) client-ip=3D209.61.154.103;=20
+	envelope-from=3Dpostmaster@ninomail.com; helo=3Ddfw-p103.ninomail.com
+X-TMASE-Version: StarCloud-1.3-8.2.1006-23392.006
+X-TMASE-Result: 10--2.729200-10.000000
+X-TMASE-MatchedRID: GooOU10L43zav6YmtDxNqNFig1NpvMlDPuK6nXzgR1TnBDF/TMnTXjJ=
+l
+	3MhaKU4m4vM1YF6AJbaKoonP3ywz3Y4dBcJ6M5YH0ddkKKNSSi9XH0VVrOHyJe2tcfduZIOv3Q=
+f
+	wsVk0UbtQ1faGnRfEeCS6ICxj5PROYkrzZvAd3CfT4GfHkFXnynlApuqqC+djwaBvbBpx3eXfD=
+q
+	qb3XQ/hue1U/Euj8bPgviCrXu93JNzjSufs2oTAvK4cKjK2vlq8OTZexKs73Ol3wq8bGz2prEk=
+r
+	SbZSQWFUBAqBajX2hg=3D
+X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0,39:0-0
+X-TM-Deliver-Signature: A1F966477493E8CC077EFBFD2963EE52
+Return-Path: postmaster@ninomail.com
+X-EOPAttributedMessage: 0
+X-EOPTenantAttributedMessage: caef7785-c073-4453-8b47-6432b6b5b10f:0
+X-Forefront-Antispam-Report: CIP:52.58.62.203;IPV:NLI;CTRY:US;EFV:NLI;
+X-Microsoft-Exchange-Diagnostics: 1;HE1EUR01FT040;1:8Yfy3RCcMtWjd2wHETuKGgb=
+YvMhwEmz4LIe9f7oSB4tp7h0z7cACxryH+0M3NT8qJ2/j7nTdwkEifFRCFkEmVm/8U0MfnxdPin=
+eDdDC5D9GGTRKhxkl4L+aROlRj/J3a
+X-MS-PublicTrafficType: Email
+X-MS-Office365-Filtering-Correlation-Id: c68ecd6c-bb49-4ed3-2782-08d5122afa=
+fa
+X-DkimResult-Test: Passed
+X-Microsoft-Antispam:
+	UriScan:;BCL:0;PCL:0;RULEID:(22001)(23075)(421252002)(3001016)(71702078);S=
+RVR:DB5PR06MB1800;
+X-Microsoft-Exchange-Diagnostics:
+	1;DB5PR06MB1800;3:eIUBG2d+QhGEssrKUk0vR7Qo1xBaLzxFYKXinPbtC3lbNOOKl0ptZ6Dw=
+pd5/OvUk0hZRjDmU0H0A+3+cYAwCf+XK0aF+w/f/0BM1HB6RqZvKasYY4skANmQh1SUIE3/Nlmm=
+fNUCPAXe2mYko5gjHS3FWfNfn5JUpUc0uqi1CiQZuz75UkMI1StjnNztymn4Poa04bv329Q323g=
+fsNJDTRWxvCNmrgSBqavZ85LE43+/3tXAXH25lu0HWaLJbf+P7M91/9m1dGEE3lE9BSHAgsW5mx=
+Y0Rgk9Cfi44Cz2zJn1W5JH5LJ2aR7fnETCIBMSnTmU9lskn5OxBoBsug3J1sg=3D=3D;25:QhTo=
+XBW84g8b1E0tDQz1wlgKZHT3MfBBXPqER0vHXiVfl5tgVG8PQ9vjAYKosqQIh25bjvo5I/HrmLe=
+8XFOg6bYQI/VrzqPSE6wBZTZ+nZ8dFdyWwRSbX85RKC9pm62yFaIbsOkta1xF/q8CE5nyFkKfUx=
+Ht9vHosW4IrzT7+w8XAhh0VqhUYOvk4Cp1St3M8L8GAu90Dj3kaupTwZhxUxVkYVewyc8xb74an=
+pZIASat5MjRVcVH26j5EUwN24Ko1RUunp7SXLydpXqJKUJcxjbJe6absxj+5Fb2GzCQh+k/9quB=
+IDXusyO9MsAorZoZMVUVl/pmy/6V/KYy9AfpsAgvXvZoa31ftGl2wTt6t3k=3D
+X-MS-TrafficTypeDiagnostic: DB5PR06MB1800:
+
+ += + +--75454191-d3d5-48ec-b8f1-8aa1d75d02e4-- + +--22a54575-c842-43f3-83ea-721e8360fb4c +Content-Type: message/delivery-status + +Reporting-MTA: dns;DB5PR06MB1800.eurprd06.prod.outlook.com +Received-From-MTA: dns;ioutemea3.hes.trendmicro.eu +Arrival-Date: Fri, 13 Oct 2017 11:10:16 +0000 + +Original-Recipient: rfc822;noname@example.com +Final-Recipient: rfc822;noname@example.com +Action: failed +Status: 5.1.10 +Diagnostic-Code: smtp;550 5.1.10 RESOLVER.ADR.RecipientNotFound; Recipient noname@example.com not found by SMTP address lookup + + +--22a54575-c842-43f3-83ea-721e8360fb4c +Content-Type: message/rfc822 + +Received: from VI1PR0601CA0032.eurprd06.prod.outlook.com + (2603:10a6:800:1e::42) by DB5PR06MB1800.eurprd06.prod.outlook.com + (2a01:111:e400:7905::18) with Microsoft SMTP Server (version=TLS1_2, + cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 13 Oct + 2017 11:10:16 +0000 +Received: from HE1EUR01FT040.eop-EUR01.prod.protection.outlook.com + (2a01:111:f400:7e1f::206) by VI1PR0601CA0032.outlook.office365.com + (2603:10a6:800:1e::42) with Microsoft SMTP Server (version=TLS1_2, + cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Frontend + Transport; Fri, 13 Oct 2017 11:10:15 +0000 +Authentication-Results: spf=softfail (sender IP is 52.58.62.203) + smtp.mailfrom=ninomail.com; example.com; dkim=pass (signature was + verified) header.d=ninomail.com;example.com; dmarc=none action=none + header.from=mailgunhq.com; +Received-SPF: SoftFail (protection.outlook.com: domain of transitioning + ninomail.com discourages use of 52.58.62.203 as permitted sender) +Received: from ioutemea3.hes.trendmicro.eu (52.58.62.203) by + HE1EUR01FT040.mail.protection.outlook.com (10.152.1.72) with Microsoft SMTP + Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id + 15.20.77.10 via Frontend Transport; Fri, 13 Oct 2017 11:10:14 +0000 +Received: from 209.61.154.103_hes.trendmicro.com (unknown [192.168.13.217]) + by ioutemea3.hes.trendmicro.eu (Postfix) with SMTP id 749FD11200E + for ; Fri, 13 Oct 2017 11:10:14 +0000 (UTC) +Received: from dfw-p103.ninomail.com (unknown [209.61.154.103]) + by inpreemea2.hes.trendmicro.eu (Postfix) with ESMTPS id 2D9022EE05E + for ; Fri, 13 Oct 2017 11:10:13 +0000 (UTC) +DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=ninomail.com; q=dns/txt; s=mx; + t=1507893012; h=Content-Transfer-Encoding: Mime-Version: Content-Type: + Subject: From: To: Message-Id: List-Unsubscribe: Date; + bh=Z0RRkWGMZ95HQdCnkNkIEgrcz3FH2ScG0r54JXFR3Vw=; b=ArQ3Q8lB0KCJxNGU0uwQe8mnOWDTlOi+T0lie9zlMs/kk7xgbuJBtt0xfE40o/gIlYENQ5VV + yrubfcZ0JTnszpw2QJVLJs/ETig+ZA10qRXR7P+EwzbyCI7XEneMrcwQsBFbrDBHiMVsPCws + 6Sppee8wcuTNbWfkdOhbY8xpQ/o= +DomainKey-Signature: a=rsa-sha1; c=nofws; d=ninomail.com; s=mx; q=dns; + h=Date: List-Unsubscribe: Message-Id: To: From: Subject: Content-Type: + Mime-Version: Content-Transfer-Encoding; + b=keeX65FWYAvnsAB/PT4Bwv5z2gZlber/+lccOi3sEbbWy+dBP58bVTxMju9kTjV5FR8Nix + ePnEngG56ziSjkEXiPLI2bIfLYZf0sByiB4giyTlejQW4su2ymBVfIX0pj/P9TT/Hk24ZtPF + DFQfd2DXdV+ssayd7A0boyiqyrrOk= +Date: Fri, 13 Oct 2017 11:10:12 +0000 +X-Mailgun-Sending-Ip: 209.61.154.103 +X-Mailgun-Sid: WyJlYjg3MCIsICJob3JraGVAc3VwZXJvZmZpY2UuY29tIiwgIjYiXQ== +List-Unsubscribe: +Received: by luna.mailgun.net with HTTP; Fri, 13 Oct 2017 11:10:11 +0000 +Message-ID: <20171013111011.20866.254C2F3A4D7AA526@ninomail.com> +X-Mailgun-Native-Send: yes +To: noname@example.com +From: noname@mailgunhq.com +Subject: test_bounce 8 +Content-Type: text/plain; charset="ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-TM-Received-SPF: Pass (domain of postmaster@ninomail.com designates + 209.61.154.103 as permitted sender) client-ip=209.61.154.103; + envelope-from=postmaster@ninomail.com; helo=dfw-p103.ninomail.com +X-TMASE-Version: StarCloud-1.3-8.2.1006-23392.006 +X-TMASE-Result: 10--2.729200-10.000000 +X-TMASE-MatchedRID: GooOU10L43zav6YmtDxNqNFig1NpvMlDPuK6nXzgR1TnBDF/TMnTXjJl + 3MhaKU4m4vM1YF6AJbaKoonP3ywz3Y4dBcJ6M5YH0ddkKKNSSi9XH0VVrOHyJe2tcfduZIOv3Qf + wsVk0UbtQ1faGnRfEeCS6ICxj5PROYkrzZvAd3CfT4GfHkFXnynlApuqqC+djwaBvbBpx3eXfDq + qb3XQ/hue1U/Euj8bPgviCrXu93JNzjSufs2oTAvK4cKjK2vlq8OTZexKs73Ol3wq8bGz2prEkr + SbZSQWFUBAqBajX2hg= +X-TMASE-SNAP-Result: 1.821001.0001-0-1-12:0,22:0,33:0,34:0,39:0-0 +X-TM-Deliver-Signature: A1F966477493E8CC077EFBFD2963EE52 +Return-Path: postmaster@ninomail.com +X-EOPAttributedMessage: 0 +X-EOPTenantAttributedMessage: caef7785-c073-4453-8b47-6432b6b5b10f:0 +X-Forefront-Antispam-Report: CIP:52.58.62.203;IPV:NLI;CTRY:US;EFV:NLI; +X-Microsoft-Exchange-Diagnostics: 1;HE1EUR01FT040;1:8Yfy3RCcMtWjd2wHETuKGgbYvMhwEmz4LIe9f7oSB4tp7h0z7cACxryH+0M3NT8qJ2/j7nTdwkEifFRCFkEmVm/8U0MfnxdPineDdDC5D9GGTRKhxkl4L+aROlRj/J3a +X-MS-PublicTrafficType: Email +X-MS-Office365-Filtering-Correlation-Id: c68ecd6c-bb49-4ed3-2782-08d5122afafa +X-DkimResult-Test: Passed +X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(23075)(421252002)(3001016)(71702078);SRVR:DB5PR06MB1800; +X-Microsoft-Exchange-Diagnostics: 1;DB5PR06MB1800;3:eIUBG2d+QhGEssrKUk0vR7Qo1xBaLzxFYKXinPbtC3lbNOOKl0ptZ6Dwpd5/OvUk0hZRjDmU0H0A+3+cYAwCf+XK0aF+w/f/0BM1HB6RqZvKasYY4skANmQh1SUIE3/NlmmfNUCPAXe2mYko5gjHS3FWfNfn5JUpUc0uqi1CiQZuz75UkMI1StjnNztymn4Poa04bv329Q323gfsNJDTRWxvCNmrgSBqavZ85LE43+/3tXAXH25lu0HWaLJbf+P7M91/9m1dGEE3lE9BSHAgsW5mxY0Rgk9Cfi44Cz2zJn1W5JH5LJ2aR7fnETCIBMSnTmU9lskn5OxBoBsug3J1sg==;25:QhToXBW84g8b1E0tDQz1wlgKZHT3MfBBXPqER0vHXiVfl5tgVG8PQ9vjAYKosqQIh25bjvo5I/HrmLe8XFOg6bYQI/VrzqPSE6wBZTZ+nZ8dFdyWwRSbX85RKC9pm62yFaIbsOkta1xF/q8CE5nyFkKfUxHt9vHosW4IrzT7+w8XAhh0VqhUYOvk4Cp1St3M8L8GAu90Dj3kaupTwZhxUxVkYVewyc8xb74anpZIASat5MjRVcVH26j5EUwN24Ko1RUunp7SXLydpXqJKUJcxjbJe6absxj+5Fb2GzCQh+k/9quBIDXusyO9MsAorZoZMVUVl/pmy/6V/KYy9AfpsAgvXvZoa31ftGl2wTt6t3k= +X-MS-TrafficTypeDiagnostic: DB5PR06MB1800: + +test + + +To unsubscribe click: + + +--22a54575-c842-43f3-83ea-721e8360fb4c-- diff --git a/tests/mime/bounce_tests.py b/tests/mime/bounce_tests.py index 6518dab8..9e71eda5 100644 --- a/tests/mime/bounce_tests.py +++ b/tests/mime/bounce_tests.py @@ -1,25 +1,66 @@ -from nose.tools import ok_, eq_, assert_false -from flanker.mime import create -from tests import BOUNCE, SIGNED +from nose.tools import eq_ +from flanker.mime import create, bounce +from tests import BOUNCE, SIGNED, BOUNCE_OFFICE365 -def test_bounce_analyzer_on_bounce(): - bm = create.from_string(BOUNCE) - ok_(bm.is_bounce()) - eq_('5.1.1', bm.bounce.status) - eq_('smtp; 550-5.1.1 The email account that you tried to reach does' - ' not exist. Please try 550-5.1.1 double-checking the recipient\'s email' - ' address for typos or 550-5.1.1 unnecessary spaces. Learn more at' - ' 550 5.1.1 http://mail.google.com/support/bin/answer.py?answer=6596' - ' 17si20661415yxe.22', - bm.bounce.diagnostic_code) +def test_bounce_detect(): + for i, tc in enumerate([{ + 'desc': 'Common bounce example', + 'mime': create.from_string(BOUNCE), + 'result': bounce.Result( + score=1.875, + status=u'5.1.1', + notification=( + u"This is the mail system at host mail.example.com.\n\n" + u"I'm sorry to have to inform you that your message could not\n" + u"be delivered to one or more recipients. It's attached below.\n\n" + u"For further assistance, please send mail to postmaster.\n\n" + u"If you do so, please include this problem report. You can\n" + u"delete your own text from the attached returned message.\n\n" + u" The mail system\n\n" + u": host\n" + u" gmail-smtp-in.l.google.com[209.85.210.17] said: 550-5.1.1 The email account\n" + u" that you tried to reach does not exist. Please try 550-5.1.1\n" + u" double-checking the recipient's email address for typos or 550-5.1.1\n" + u" unnecessary spaces. Learn more at 550 5.1.1\n" + u" http://mail.google.com/support/bin/answer.py?answer=6596 17si20661415yxe.22\n" + u" (in reply to RCPT TO command)\n"), + diagnostic_code=( + u"smtp; 550-5.1.1 The email account that you tried to reach does" + u" not exist. Please try 550-5.1.1 double-checking the recipient's email" + u" address for typos or 550-5.1.1 unnecessary spaces. Learn more at" + u" 550 5.1.1 http://mail.google.com/support/bin/answer.py?answer=6596" + u" 17si20661415yxe.22")) + }, { + 'desc': 'Office365 bounce messages lack Content-Description', + 'mime': create.from_string(BOUNCE_OFFICE365), + 'result': bounce.Result( + score=1.25, + status=u'5.1.10', + notification=u'', + diagnostic_code=( + u'smtp;550 5.1.10 RESOLVER.ADR.RecipientNotFound; ' + u'Recipient noname@example.com not found by SMTP address lookup') + ) + }, { + 'desc': 'Regular message', + 'mime': create.from_string(SIGNED), + 'result': bounce.Result( + score=0.0, + status=u'', + notification=u'', + diagnostic_code=u'' + ) + }]): + print('Test case #%d: %s' % (i, tc['desc'])) -def test_bounce_analyzer_on_regular(): - bm = create.from_string(SIGNED) - assert_false(bm.is_bounce()) + # When + result = bounce.detect(tc['mime']) - -def test_bounce_no_headers_error_message(): - msg = create.from_string('Nothing') - assert_false(msg.is_bounce()) + # Then + eq_(result, tc['result']) + eq_(result.score, tc['result'].score) + eq_(result.status, tc['result'].status) + eq_(result.notification, tc['result'].notification) + eq_(result.diagnostic_code, tc['result'].diagnostic_code)