email.message_from_string无法解析Outlook原始源消息

时间:2019-08-02 01:44:39

标签: python email parsing outlook

我正在尝试使用Outlook中的原始来源消息来解析多部分电子邮件。电子邮件分为两部分:纯文本和html。 email.message_from_string无法正确解析原始电子邮件。它不返回2部分,并且_payload包括除前2行以外的所有内容。

我使用email.message_from_string(raw_email)来解析原始原始源消息,但它没有正确地对其进行解析。

注意:为了确保简短,我将大部分电子邮件剪掉了。

来自Outlook的原始源消息

Received: from SN1NAM04HT187.eop-NAM04.prod.protection.outlook.com
(2603:10b6:300:d4::32) by CO2PR01MB1959.prod.exchangelabs.com with HTTPS via
MWHPR19CA0022.NAMPRD19.PROD.OUTLOOK.COM; Wed, 31 Jul 2019 19:52:30 +0000
Received: from SN1NAM04FT005.eop-NAM04.prod.protection.outlook.com
(10.152.88.55) by SN1NAM04HT187.eop-NAM04.prod.protection.outlook.com
(10.152.89.14) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Wed, 31 Jul
2019 19:52:29 +0000
Authentication-Results: spf=pass (sender IP is 50.31.51.89)
smtp.mailfrom=sendgrid.blabla.com; windowslive.com; dkim=pass (signature was
verified) header.d=blabla.com;windowslive.com; dmarc=pass action=none
header.from=blabla.com;
Received-SPF: Pass (protection.outlook.com: domain of sendgrid.blabla.com
designates 50.31.51.89 as permitted sender) receiver=protection.outlook.com;
client-ip=50.31.51.89; helo=o1.email-sg.blabla.com;
Received: from o1.email-sg.blabla.com (50.31.51.89) by
SN1NAM04FT005.mail.protection.outlook.com (10.152.88.160) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.2136.14 via Frontend Transport; Wed, 31 Jul 2019 19:52:29 +0000
X-IncomingTopHeaderMarker: OriginalChecksum:0A3835CC8F7E76F92E22A1986408E34F6CB0EE38219063E844D0BB1572B82825;UpperCasedChecksum:3B51CEDA7CBD6FB06905BA9CCFA3417B571F394F0412206B12B87927F8C8FE0B;SizeAsReceived:1804;Count:15
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=blabla.com; 
h=from:sender:to:subject:mime-version:content-type; s=s1; 
bh=wEOiatvA5BWHjVFwDPHy3RC5ur4=; b=Y/sBR8/uaU5y+7GN3GanXk7dlsUId
bQjsB7HfZp6fdDuVo9EIKrFn9uffrsqJpXO6DFqX5rWWCvgTMYPnsM8Iy3ekU0sD
psxBZ186ROAoalowdniEsGZ/fTMan4JEXEWhlKKpGHxGR102lz1qylqRazxFlOEY
5yhWp6dJjLegIg=
Received: by filter0246p1iad2.sendgrid.net with SMTP id filter0246p1iad2-24721-5D41F17C-8
2019-07-31 19:52:28.625630772 +0000 UTC m=+518882.143553260
Received: from iad1gmta02.localdomain (unknown [192.88.178.20])
by ismtpd0002p1iad2.sendgrid.net (SG) with ESMTP id GrDTvaa3R6yukBfilmmfMw
for <y@windowslive.com>; Wed, 31 Jul 2019 19:52:28.454 +0000 (UTC)
Received: from iad1gbos.localdomain (unknown [10.3.65.145])
by iad1gmta02.localdomain (Postfix) with ESMTP id 62A8812AEA4D
for <y@windowslive.com>; Wed, 31 Jul 2019 15:52:28 -0400 (EDT)
Received: from iad1gbos.ecom.blabla.com (localhost [127.0.0.1])
by iad1gbos.localdomain (Postfix) with ESMTP id 57CD51013601
for <y@windowslive.com>; Wed, 31 Jul 2019 15:52:28 -0400 (EDT)
From: "blabla.com" <service@blabla.com>
Sender: "blabla.com" <service@blabla.com>
To: yc@windowslive.com
Message-ID: <1943845105.133098.1564602748358@localhost>
Subject: Thanks for your blabla order!
Content-Type: multipart/alternative; 
boundary="----=_Part_12654_1135590884.1564602743147"
Date: Wed, 31 Jul 2019 19:52:28 +0000
X-SG-EID: KlhL5+04rpq9b+lNnUQSSXSv/U/Agrwcy5kw6hHCP8rbih+DKKzTjpaizOf9gI4jfUbeoQFtkwaLeA
Q5VJW+s2G92MVJdOKnwbJCcJQrsVc4oiuZgDCBS8dpWhU6KfIM6V5wL2yNP0pKKCugS+b4cgX4K5CX
GndIFYXJXa1LTZLPblTMNhH8QH5+kLY4Wtg9po8FuNUzEJaPXsJgnMHYzKZOIvAvnevqNIcyYVL2Yc
0=
X-SG-ID: DT9Vw4eifUpKg3EkHbNxgoJgjlm7TnFJRHcoaVv1UYo=
X-IncomingHeaderCount: 15
Return-Path: bounces+266386-caec-yc=windowslive.com@sendgrid.blabla.com
X-MS-Exchange-Organization-ExpirationStartTime: 31 Jul 2019 19:52:29.3384
(UTC)
X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
X-MS-Exchange-Organization-Network-Message-Id: 0748a39e-bdb3-4241-2271-08d715f09e99
X-EOPAttributedMessage: 0
X-EOPTenantAttributedMessage: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa:0
X-MS-Exchange-Organization-MessageDirectionality: Incoming
X-Forefront-Antispam-Report: EFV:NLI;
X-MS-Exchange-Organization-AuthSource:
SN1NAM04FT005.eop-NAM04.prod.protection.outlook.com
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-PublicTrafficType: Email
X-MS-UserLastLogonTime: 7/31/2019 7:47:36 PM
X-MS-Office365-Filtering-Correlation-Id: 0748a39e-bdb3-4241-2271-08d715f09e99
X-Microsoft-Antispam:
BCL:6;PCL:0;RULEID:(2390118)(5000188)(711020)(4605104)(610169)(650170)(651021)(8291501072);SRVR:SN1NAM04HT187;
X-MS-TrafficTypeDiagnostic: SN1NAM04HT187:
X-MS-Exchange-PUrlCount: 24
X-MS-Exchange-EOPDirect: true
X-Sender-IP: 50.31.51.89
X-SID-PRA: SERVICE@blabla.COM
X-SID-Result: PASS
X-MS-Exchange-Organization-PCL: 2
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2019 19:52:29.0952
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 0748a39e-bdb3-4241-2271-08d715f09e99
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg:
00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT187
X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.1679704
X-MS-Exchange-Processed-By-BccFoldering: 15.20.2115.005
X-Microsoft-Antispam-Mailbox-Delivery:
abwl:0;wl:0;pcwl:0;kl:0;iwl:0;ijl:0;dwl:0;dkl:0;rwl:0;ucf:0;jmr:0;ex:0;auth:1;dest:I;ENG:(5062000261)(5061607266)(5061608174)(4900115)(4920090)(6515079)(4950130)(4990090);
X-Message-Info:
5vMbyqxGkdee9CWP6GN6k7SiFatHA5tOJthXLYGApF09RV+2VIwDSv7TpFIyyuwbdpElZ/0OfDQ0pBW79cd9agnpjGQw7b7v7zA6S/RBHvx/Foariz/CKmDCPiOrCScSKVW9YaM/CqKL76WFalT2LUf8VJBR8M4LupokoBm/WazuStfNPUu2PvSCEzFxbvn/ptMxVl+4wEXDPQivJ1nuMw==
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtHRD0xO1NDTD0z
X-Microsoft-Antispam-Message-Info:
1PVG+UKcd/9R+HkjIXvLA0AQVREwyDmXR6XmnL6oX6xks/yw3ZQRARX4fYngU4vXeDhoJr9kyTA6Bpm3OE5FZn8+JPH3p24pamcQhTiI/RdyRHAOx7q7YHb9PzM3EkY2hOb6qF/QxCZPdshlewXqGe+azoh4Sr9CPUL8x7gtZS0XVBYBQMtHRW0NsS0ULp/4e4+lbGoyQcXdMGoy4Cf6ACU783dlOjDyZNkz2Frk3vm3Za/P3avHn46xf8WzHrDbbfOiVc+HXFAQxBOWbQPD0rkXNssXlOszegvDX7nPq9hdj8UadbqhECjiizH890bNwqKIa2sWd/d1HBfojK2FDsEOPwDSsIS/1ApF038jELtjpzkzSadz319o6VohzYUHm7CtRF9sqJTgLVKePBo/i8FrLeoCq2rXydXj6a9MS7SqLDfny7NlP/qId5z5GXFs63K/QXu3InYLIf5zcl/kgsvg+W0cHDZ4/IdBPvHGeaQn7hdf62IKftys3CspYBbSlt0Eus97CCddOX/EBaJpJ7nEpHxIL3pxKVY0kKWqaUqrvvC3mvCffBe3igaAq2LiHgvT0pIU+j0y41VwEn7X8rL8gyWpbBF64+wf8NAe8JM2N8aWudElAkIeA5GHJodGcXt+jdyhYzh3EZs1BWyrF+k6MPp4kU/9yVxAxBimBx1aje5geHD7NggWqFJAD6fv0XsSjxku4Tap6Zs+NEkoD/MHNyT6TMnu9cqGgEoznr2mTssEZkz0JRPgcb2YbZabybkxBRJjVi/aroSjtOj2V2JHo9m2F8bA4XhLrLwgJzOs1ZelyYFKZ3OMaUAS9yNRlSPHBSKm/WUzIMNkcHLCcg==
MIME-Version: 1.0

------=_Part_12654_1135590884.1564602743147
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi c y,

Thanks for your order! Your order information appears below.

Item(s) Subtotal: $1.79
Shipping: $4.95
----
Total Before Tax: $6.74
Estimated Tax: $0.15
----
Order Total: $6.89

Shipping Address:


blabla.com
https://www.blabla.com
1-800-672-4399
------=_Part_12654_1135590884.1564602743147
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!--[if !mso]><!--><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link href="http://cms.blabla.com/fonts/roboto/email-font.css" rel="stylesheet" type="text/css">

<style type="text/css">
@font-face {
font-family: 'Roboto';
src: url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.eot');
src: url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.woff') format('woff'),
url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.ttf') format('truetype'),
url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.svg#robotoregular') format('svg');
font-weight:400;
font-style:normal;
}

</style>
<div width="100%" style="display:none;font-size:0px;color:#eeeeee;line-height:1px;text-align:center;opacity:0;overflow:hidden;max-height:0px;max-width:0px;">
Questions? Call us any time 24/7 at 1-800-672-4399 or simply reply to this email | blabla.com
</div>

------=_Part_12654_1135590884.1564602743147--

结果:

{'_charset': None,
 '_default_type': 'text/plain',
 '_headers': [('Received',
   'from SN1NAM04HT187.eop-NAM04.prod.protection.outlook.com'),
  ('(2603',
   '10b6:300:d4::32) by CO2PR01MB1959.prod.exchangelabs.com with HTTPS via')],
 '_payload': 'Received: from SN1NAM04HT187.eop-NAM04.prod.protection.outlook.com
(2603:10b6:300:d4::32) by CO2PR01MB1959.prod.exchangelabs.com with HTTPS via
MWHPR19CA0022.NAMPRD19.PROD.OUTLOOK.COM; Wed, 31 Jul 2019 19:52:30 +0000
Received: from SN1NAM04FT005.eop-NAM04.prod.protection.outlook.com
(10.152.88.55) by SN1NAM04HT187.eop-NAM04.prod.protection.outlook.com
(10.152.89.14) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Wed, 31 Jul
2019 19:52:29 +0000
Authentication-Results: spf=pass (sender IP is 50.31.51.89)
smtp.mailfrom=sendgrid.blabla.com; windowslive.com; dkim=pass (signature was
verified) header.d=blabla.com;windowslive.com; dmarc=pass action=none
header.from=blabla.com;
Received-SPF: Pass (protection.outlook.com: domain of sendgrid.blabla.com
designates 50.31.51.89 as permitted sender) receiver=protection.outlook.com;
client-ip=50.31.51.89; helo=o1.email-sg.blabla.com;
Received: from o1.email-sg.blabla.com (50.31.51.89) by
SN1NAM04FT005.mail.protection.outlook.com (10.152.88.160) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.2136.14 via Frontend Transport; Wed, 31 Jul 2019 19:52:29 +0000
X-IncomingTopHeaderMarker: OriginalChecksum:0A3835CC8F7E76F92E22A1986408E34F6CB0EE38219063E844D0BB1572B82825;UpperCasedChecksum:3B51CEDA7CBD6FB06905BA9CCFA3417B571F394F0412206B12B87927F8C8FE0B;SizeAsReceived:1804;Count:15
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=blabla.com; 
h=from:sender:to:subject:mime-version:content-type; s=s1; 
bh=wEOiatvA5BWHjVFwDPHy3RC5ur4=; b=Y/sBR8/uaU5y+7GN3GanXk7dlsUId
bQjsB7HfZp6fdDuVo9EIKrFn9uffrsqJpXO6DFqX5rWWCvgTMYPnsM8Iy3ekU0sD
psxBZ186ROAoalowdniEsGZ/fTMan4JEXEWhlKKpGHxGR102lz1qylqRazxFlOEY
5yhWp6dJjLegIg=
Received: by filter0246p1iad2.sendgrid.net with SMTP id filter0246p1iad2-24721-5D41F17C-8
2019-07-31 19:52:28.625630772 +0000 UTC m=+518882.143553260
Received: from iad1gmta02.localdomain (unknown [192.88.178.20])
by ismtpd0002p1iad2.sendgrid.net (SG) with ESMTP id GrDTvaa3R6yukBfilmmfMw
for <y@windowslive.com>; Wed, 31 Jul 2019 19:52:28.454 +0000 (UTC)
Received: from iad1gbos.localdomain (unknown [10.3.65.145])
by iad1gmta02.localdomain (Postfix) with ESMTP id 62A8812AEA4D
for <y@windowslive.com>; Wed, 31 Jul 2019 15:52:28 -0400 (EDT)
Received: from iad1gbos.ecom.blabla.com (localhost [127.0.0.1])
by iad1gbos.localdomain (Postfix) with ESMTP id 57CD51013601
for <y@windowslive.com>; Wed, 31 Jul 2019 15:52:28 -0400 (EDT)
From: "blabla.com" <service@blabla.com>
Sender: "blabla.com" <service@blabla.com>
To: yc@windowslive.com
Message-ID: <1943845105.133098.1564602748358@localhost>
Subject: Thanks for your blabla order!
Content-Type: multipart/alternative; 
boundary="----=_Part_12654_1135590884.1564602743147"
Date: Wed, 31 Jul 2019 19:52:28 +0000
X-SG-EID: KlhL5+04rpq9b+lNnUQSSXSv/U/Agrwcy5kw6hHCP8rbih+DKKzTjpaizOf9gI4jfUbeoQFtkwaLeA
Q5VJW+s2G92MVJdOKnwbJCcJQrsVc4oiuZgDCBS8dpWhU6KfIM6V5wL2yNP0pKKCugS+b4cgX4K5CX
GndIFYXJXa1LTZLPblTMNhH8QH5+kLY4Wtg9po8FuNUzEJaPXsJgnMHYzKZOIvAvnevqNIcyYVL2Yc
0=
X-SG-ID: DT9Vw4eifUpKg3EkHbNxgoJgjlm7TnFJRHcoaVv1UYo=
X-IncomingHeaderCount: 15
Return-Path: bounces+266386-caec-yc=windowslive.com@sendgrid.blabla.com
X-MS-Exchange-Organization-ExpirationStartTime: 31 Jul 2019 19:52:29.3384
(UTC)
X-MS-Exchange-Organization-ExpirationStartTimeReason: OriginalSubmit
X-MS-Exchange-Organization-ExpirationInterval: 1:00:00:00.0000000
X-MS-Exchange-Organization-ExpirationIntervalReason: OriginalSubmit
X-MS-Exchange-Organization-Network-Message-Id: 0748a39e-bdb3-4241-2271-08d715f09e99
X-EOPAttributedMessage: 0
X-EOPTenantAttributedMessage: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa:0
X-MS-Exchange-Organization-MessageDirectionality: Incoming
X-Forefront-Antispam-Report: EFV:NLI;
X-MS-Exchange-Organization-AuthSource:
SN1NAM04FT005.eop-NAM04.prod.protection.outlook.com
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-PublicTrafficType: Email
X-MS-UserLastLogonTime: 7/31/2019 7:47:36 PM
X-MS-Office365-Filtering-Correlation-Id: 0748a39e-bdb3-4241-2271-08d715f09e99
X-Microsoft-Antispam:
BCL:6;PCL:0;RULEID:(2390118)(5000188)(711020)(4605104)(610169)(650170)(651021)(8291501072);SRVR:SN1NAM04HT187;
X-MS-TrafficTypeDiagnostic: SN1NAM04HT187:
X-MS-Exchange-PUrlCount: 24
X-MS-Exchange-EOPDirect: true
X-Sender-IP: 50.31.51.89
X-SID-PRA: SERVICE@blabla.COM
X-SID-Result: PASS
X-MS-Exchange-Organization-PCL: 2
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2019 19:52:29.0952
(UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 0748a39e-bdb3-4241-2271-08d715f09e99
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg:
00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM04HT187
X-MS-Exchange-Transport-EndToEndLatency: 00:00:01.1679704
X-MS-Exchange-Processed-By-BccFoldering: 15.20.2115.005
X-Microsoft-Antispam-Mailbox-Delivery:
abwl:0;wl:0;pcwl:0;kl:0;iwl:0;ijl:0;dwl:0;dkl:0;rwl:0;ucf:0;jmr:0;ex:0;auth:1;dest:I;ENG:(5062000261)(5061607266)(5061608174)(4900115)(4920090)(6515079)(4950130)(4990090);
X-Message-Info:
5vMbyqxGkdee9CWP6GN6k7SiFatHA5tOJthXLYGApF09RV+2VIwDSv7TpFIyyuwbdpElZ/0OfDQ0pBW79cd9agnpjGQw7b7v7zA6S/RBHvx/Foariz/CKmDCPiOrCScSKVW9YaM/CqKL76WFalT2LUf8VJBR8M4LupokoBm/WazuStfNPUu2PvSCEzFxbvn/ptMxVl+4wEXDPQivJ1nuMw==
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0xO0Q9MTtHRD0xO1NDTD0z
X-Microsoft-Antispam-Message-Info:
1PVG+UKcd/9R+HkjIXvLA0AQVREwyDmXR6XmnL6oX6xks/yw3ZQRARX4fYngU4vXeDhoJr9kyTA6Bpm3OE5FZn8+JPH3p24pamcQhTiI/RdyRHAOx7q7YHb9PzM3EkY2hOb6qF/QxCZPdshlewXqGe+azoh4Sr9CPUL8x7gtZS0XVBYBQMtHRW0NsS0ULp/4e4+lbGoyQcXdMGoy4Cf6ACU783dlOjDyZNkz2Frk3vm3Za/P3avHn46xf8WzHrDbbfOiVc+HXFAQxBOWbQPD0rkXNssXlOszegvDX7nPq9hdj8UadbqhECjiizH890bNwqKIa2sWd/d1HBfojK2FDsEOPwDSsIS/1ApF038jELtjpzkzSadz319o6VohzYUHm7CtRF9sqJTgLVKePBo/i8FrLeoCq2rXydXj6a9MS7SqLDfny7NlP/qId5z5GXFs63K/QXu3InYLIf5zcl/kgsvg+W0cHDZ4/IdBPvHGeaQn7hdf62IKftys3CspYBbSlt0Eus97CCddOX/EBaJpJ7nEpHxIL3pxKVY0kKWqaUqrvvC3mvCffBe3igaAq2LiHgvT0pIU+j0y41VwEn7X8rL8gyWpbBF64+wf8NAe8JM2N8aWudElAkIeA5GHJodGcXt+jdyhYzh3EZs1BWyrF+k6MPp4kU/9yVxAxBimBx1aje5geHD7NggWqFJAD6fv0XsSjxku4Tap6Zs+NEkoD/MHNyT6TMnu9cqGgEoznr2mTssEZkz0JRPgcb2YbZabybkxBRJjVi/aroSjtOj2V2JHo9m2F8bA4XhLrLwgJzOs1ZelyYFKZ3OMaUAS9yNRlSPHBSKm/WUzIMNkcHLCcg==
MIME-Version: 1.0

------=_Part_12654_1135590884.1564602743147
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Hi c y,

Thanks for your order! Your order information appears below.

Item(s) Subtotal: $1.79
Shipping: $4.95
----
Total Before Tax: $6.74
Estimated Tax: $0.15
----
Order Total: $6.89

Shipping Address:


blabla.com
https://www.blabla.com
1-800-672-4399
------=_Part_12654_1135590884.1564602743147
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!--[if !mso]><!--><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link href="http://cms.blabla.com/fonts/roboto/email-font.css" rel="stylesheet" type="text/css">

<style type="text/css">
@font-face {
font-family: 'Roboto';
src: url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.eot');
src: url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.woff') format('woff'),
url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.ttf') format('truetype'),
url('http://cms.blabla.com/fonts/roboto/Roboto-Regular-webfont.svg#robotoregular') format('svg');
font-weight:400;
font-style:normal;
}

</style>
<div width="100%" style="display:none;font-size:0px;color:#eeeeee;line-height:1px;text-align:center;opacity:0;overflow:hidden;max-height:0px;max-width:0px;">
Questions? Call us any time 24/7 at 1-800-672-4399 or simply reply to this email | blabla.com
</div>

------=_Part_12654_1135590884.1564602743147--',
 '_unixfrom': None,
 'defects': [],
 'epilogue': None,
 'preamble': None}

您可以看到结果返回了完整的原始电子邮件源消息作为有效载荷,但前两行除外。电子邮件应分为两部分,一个为text/plain,另一个为text/htmlMIME-Version: 1.0之前的行不应包含在payload中。谢谢!

1 个答案:

答案 0 :(得分:0)

问题是电子邮件源消息的格式。当我从Outlook客户端复制粘贴它时,格式被破坏了,因此我必须手动修复它才能正确解析。我不得不在某些行之前放置制表符,如下所示:

Received: from SN1NAM04HT187.eop-NAM04.prod.protection.outlook.com
        (2603:10b6:300:d4::32) by CO2PR01MB1959.prod.exchangelabs.com with 
        HTTPS via
        MWHPR19CA0022.NAMPRD19.PROD.OUTLOOK.COM; Wed, 31 Jul 2019 19:52:30 +0000
Received: from SN1NAM04FT005.eop-NAM04.prod.protection.outlook.com
        (10.152.88.55) by SN1NAM04HT187.eop-NAM04.prod.protection.outlook.com
        (10.152.89.14) with Microsoft SMTP Server (version=TLS1_2,
        cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Wed, 31 
        Jul 2019 19:52:29 +0000
Authentication-Results: spf=pass (sender IP is 50.31.51.89)
                      smtp.mailfrom=sendgrid.blabla.com; windowslive.com; 
                      dkim=pass (signature was
                      verified) header.d=blabla.com;windowslive.com; dmarc=pass 
                      action=none
header.from=blabla.com;