Content-Type: multipart/mixed;
boundary=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
--bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
This is a message with a base64 encoded attached email
--bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Content-Disposition: attachment; filename="attached_email.eml"
Content-Type: message/rfc822
Content-Transfer-Encoding: base64
VG86ICJlbWFpbEBleGFtcGxlLmNvbSIgPGVtYWlsQGV4YW1wbGUuY29tPg0KRnJvbTogTmFtZSA8
ZW1haWxAZXhhbXBsZS5jb20+DQpTdWJqZWN0OiBIVE1MIHRlc3QNCk1lc3NhZ2UtSUQ6IDxyYW5k
b20tbWVzc2FnZS1pZEBleGFtcGxlLmNvbT4NCkRhdGU6IFR1ZSwgMTQgRGVjIDIwMjEgMTE6NDg6
MjUgKzAxMDANCk1JTUUtVmVyc2lvbjogMS4wDQpDb250ZW50LVR5cGU6IG11bHRpcGFydC9hbHRl
cm5hdGl2ZTsNCiBib3VuZGFyeT0iYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYSINCkNvbnRlbnQtTGFuZ3VhZ2U6IGVuLVVTDQoNClRoaXMgaXMgYSBtdWx0aS1wYXJ0IG1l
c3NhZ2UgaW4gTUlNRSBmb3JtYXQuDQotLWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWENCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtODsgZm9ybWF0
PWZsb3dlZA0KQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogN2JpdA0KDQpUaGlzIGlzIGFuICpI
VE1MKiB0ZXN0IG1lc3NhZ2UNCi0tYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYQ0KQ29udGVudC1UeXBlOiB0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgNCkNvbnRlbnQtVHJh
bnNmZXItRW5jb2Rpbmc6IDdiaXQNCg0KPGh0bWw+DQogIDxoZWFkPg0KICAgIDxtZXRhIGh0dHAt
ZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04Ij4N
CiAgPC9oZWFkPg0KICA8Ym9keT4NCiAgICBUaGlzIGlzIGFuIDxiPkhUTUw8L2I+IHRlc3QgbWVz
c2FnZQ0KICA8L2JvZHk+DQo8L2h0bWw+DQoNCi0tYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYS0tDQo=
--bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb--
---- EXPECTED STRUCTURE ----
{
"headers_rfc": {
"content_type": {
"ContentType": {
"c_type": "multipart",
"c_subtype": "mixed",
"attributes": {
"boundary": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
}
}
}
},
"headers_offsets": [
{
"name": {
"Rfc": "content_type"
},
"start": 13,
"end": 82
}
],
"html_body": [
0
],
"text_body": [
0
],
"attachments": [
1
],
"parts": [
{
"Text": {
"headers": {
"content_transfer_encoding": {
"Text": "7bit"
},
"content_type": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": {
"charset": "utf-8"
}
}
}
},
"body": "This is a message with a base64 encoded attached email"
}
},
{
"Message": {
"headers": {
"content_disposition": {
"ContentType": {
"c_type": "attachment",
"attributes": {
"filename": "attached_email.eml"
}
}
},
"content_type": {
"ContentType": {
"c_type": "message",
"c_subtype": "rfc822"
}
},
"content_transfer_encoding": {
"Text": "base64"
}
},
"body": {
"headers_rfc": {
"subject": {
"Text": "HTML test"
},
"to": {
"Address": {
"name": "email@example.com",
"address": "email@example.com"
}
},
"content_type": {
"ContentType": {
"c_type": "multipart",
"c_subtype": "alternative",
"attributes": {
"boundary": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
}
},
"from": {
"Address": {
"name": "Name",
"address": "email@example.com"
}
},
"content_language": {
"Text": "en-US"
},
"date": {
"DateTime": {
"year": 2021,
"month": 12,
"day": 14,
"hour": 11,
"minute": 48,
"second": 25,
"tz_before_gmt": false,
"tz_hour": 1,
"tz_minute": 0
}
},
"message_id": {
"Text": "random-message-id@example.com"
},
"mime_version": {
"Text": "1.0"
}
},
"headers_offsets": [
{
"name": {
"Rfc": "to"
},
"start": 3,
"end": 45
},
{
"name": {
"Rfc": "from"
},
"start": 50,
"end": 77
},
{
"name": {
"Rfc": "subject"
},
"start": 85,
"end": 97
},
{
"name": {
"Rfc": "message_id"
},
"start": 108,
"end": 142
},
{
"name": {
"Rfc": "date"
},
"start": 147,
"end": 181
},
{
"name": {
"Rfc": "mime_version"
},
"start": 194,
"end": 200
},
{
"name": {
"Rfc": "content_type"
},
"start": 213,
"end": 292
},
{
"name": {
"Rfc": "content_language"
},
"start": 309,
"end": 317
}
],
"html_body": [
1
],
"text_body": [
0
],
"parts": [
{
"Text": {
"headers": {
"content_type": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": {
"charset": "utf-8",
"format": "flowed"
}
}
},
"content_transfer_encoding": {
"Text": "7bit"
}
},
"body": "This is an *HTML* test message\r"
}
},
{
"Html": {
"headers": {
"content_type": {
"ContentType": {
"c_type": "text",
"c_subtype": "html",
"attributes": {
"charset": "utf-8"
}
}
},
"content_transfer_encoding": {
"Text": "7bit"
}
},
"body": "<html>\r\n <head>\r\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\r\n </head>\r\n <body>\r\n This is an <b>HTML</b> test message\r\n </body>\r\n</html>\r\n\r"
}
}
],
"structure": {
"List": [
{
"Part": 0
},
{
"Part": 1
}
]
},
"offset_header": 0,
"offset_body": 319,
"offset_end": 870
}
}
}
],
"structure": {
"List": [
{
"Part": 0
},
{
"Part": 1
}
]
},
"offset_header": 0,
"offset_body": 83,
"offset_end": 1648
}