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 ----{
  "html_body": [
    1
  ],
  "text_body": [
    1
  ],
  "attachments": [
    2
  ],
  "parts": [
    {
      "headers_rfc": {
        "content_type": {
          "ContentType": {
            "c_type": "multipart",
            "c_subtype": "mixed",
            "attributes": {
              "boundary": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
            }
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 13,
            "end": 82
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Multipart": [
          1,
          2
        ]
      },
      "offset_header": 0,
      "offset_body": 83,
      "offset_end": 1648
    },
    {
      "headers_rfc": {
        "content_transfer_encoding": {
          "Text": "7bit"
        },
        "content_type": {
          "ContentType": {
            "c_type": "text",
            "c_subtype": "plain",
            "attributes": {
              "charset": "utf-8"
            }
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 139,
            "end": 166
          }
        ],
        [
          {
            "Rfc": "content_transfer_encoding"
          },
          {
            "start": 192,
            "end": 198
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Text": "This is a message with a base64 encoded attached email"
      },
      "offset_header": 126,
      "offset_body": 199,
      "offset_end": 254
    },
    {
      "headers_rfc": {
        "content_transfer_encoding": {
          "Text": "base64"
        },
        "content_type": {
          "ContentType": {
            "c_type": "message",
            "c_subtype": "rfc822",
            "attributes": null
          }
        },
        "content_disposition": {
          "ContentType": {
            "c_type": "attachment",
            "c_subtype": null,
            "attributes": {
              "filename": "attached_email.eml"
            }
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_disposition"
          },
          {
            "start": 317,
            "end": 360
          }
        ],
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 373,
            "end": 389
          }
        ],
        [
          {
            "Rfc": "content_transfer_encoding"
          },
          {
            "start": 415,
            "end": 423
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Message": {
          "html_body": [
            2
          ],
          "text_body": [
            1
          ],
          "attachments": [],
          "parts": [
            {
              "headers_rfc": {
                "mime_version": {
                  "Text": "1.0"
                },
                "to": {
                  "Address": {
                    "name": "email@example.com",
                    "address": "email@example.com"
                  }
                },
                "subject": {
                  "Text": "HTML test"
                },
                "content_type": {
                  "ContentType": {
                    "c_type": "multipart",
                    "c_subtype": "alternative",
                    "attributes": {
                      "boundary": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                    }
                  }
                },
                "content_language": {
                  "Text": "en-US"
                },
                "from": {
                  "Address": {
                    "name": "Name",
                    "address": "email@example.com"
                  }
                },
                "message_id": {
                  "Text": "random-message-id@example.com"
                },
                "date": {
                  "DateTime": {
                    "year": 2021,
                    "month": 12,
                    "day": 14,
                    "hour": 11,
                    "minute": 48,
                    "second": 25,
                    "tz_before_gmt": false,
                    "tz_hour": 1,
                    "tz_minute": 0
                  }
                }
              },
              "is_encoding_problem": false,
              "body": {
                "Multipart": [
                  1,
                  2
                ]
              },
              "offset_header": 0,
              "offset_body": 319,
              "offset_end": 872
            },
            {
              "headers_rfc": {
                "content_type": {
                  "ContentType": {
                    "c_type": "text",
                    "c_subtype": "plain",
                    "attributes": {
                      "charset": "utf-8",
                      "format": "flowed"
                    }
                  }
                },
                "content_transfer_encoding": {
                  "Text": "7bit"
                }
              },
              "is_encoding_problem": false,
              "body": {
                "Text": "This is an *HTML* test message"
              },
              "offset_header": 409,
              "offset_body": 500,
              "offset_end": 532
            },
            {
              "headers_rfc": {
                "content_transfer_encoding": {
                  "Text": "7bit"
                },
                "content_type": {
                  "ContentType": {
                    "c_type": "text",
                    "c_subtype": "html",
                    "attributes": {
                      "charset": "utf-8"
                    }
                  }
                }
              },
              "is_encoding_problem": false,
              "body": {
                "Html": "<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"
              },
              "offset_header": 576,
              "offset_body": 651,
              "offset_end": 826
            }
          ]
        }
      },
      "offset_header": 297,
      "offset_body": 424,
      "offset_end": 1604
    }
  ]
}