MIME-Version: 1.0
From: Nathaniel Borenstein <nsb@nsb.fv.com>
To: Ned Freed <ned@innosoft.com>
Date: Fri, 07 Oct 1994 16:15:05 -0700 (PDT)
Subject: A multipart example
Content-Type: multipart/mixed;
            boundary=unique-boundary-1

This is the preamble area of a multipart message.
Mail readers that understand multipart format
should ignore this preamble.

If you are reading this text, you might want to
consider changing to a mail reader that understands
how to properly display multipart messages.

--unique-boundary-1

... Some text appears here ...

[Note that the blank between the boundary and the start
of the text in this part means no header fields were
given and this is text in the US-ASCII character set.
It could have been done with explicit typing as in the
next part.]

--unique-boundary-1
Content-type: text/plain; charset=US-ASCII

This could have been part of the previous part, but
illustrates explicit versus implicit typing of body
parts.

--unique-boundary-1
Content-Type: multipart/parallel; boundary=unique-boundary-2

--unique-boundary-2
Content-Type: audio/basic
Content-Transfer-Encoding: base64

... base64-encoded 8000 Hz single-channel
    mu-law-format audio data goes here ...

--unique-boundary-2
Content-Type: image/jpeg
Content-Transfer-Encoding: base64

... base64-encoded image data goes here ...

--unique-boundary-2--

--unique-boundary-1
Content-type: text/enriched

This is <bold><italic>enriched.</italic></bold>
<smaller>as defined in RFC 1896</smaller>

Isn't it
<bigger><bigger>cool?</bigger></bigger>

--unique-boundary-1
Content-Type: message/rfc822

From: (mailbox in US-ASCII)
To: (address in US-ASCII)
Subject: (subject in US-ASCII)
Content-Type: Text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: Quoted-printable

... Additional text in ISO-8859-1 goes here ...

--unique-boundary-1--

---- EXPECTED STRUCTURE ----{
  "html_body": [
    1,
    2
  ],
  "text_body": [
    1,
    2
  ],
  "attachments": [
    4,
    5,
    6,
    7
  ],
  "parts": [
    {
      "headers_rfc": {
        "subject": {
          "Text": "A multipart example"
        },
        "from": {
          "Address": {
            "name": "Nathaniel Borenstein",
            "address": "nsb@nsb.fv.com"
          }
        },
        "to": {
          "Address": {
            "name": "Ned Freed",
            "address": "ned@innosoft.com"
          }
        },
        "date": {
          "DateTime": {
            "year": 1994,
            "month": 10,
            "day": 7,
            "hour": 16,
            "minute": 15,
            "second": 5,
            "tz_before_gmt": true,
            "tz_hour": 7,
            "tz_minute": 0
          }
        },
        "mime_version": {
          "Text": "1.0"
        },
        "content_type": {
          "ContentType": {
            "c_type": "multipart",
            "c_subtype": "mixed",
            "attributes": {
              "boundary": "unique-boundary-1"
            }
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "mime_version"
          },
          {
            "start": 13,
            "end": 18
          }
        ],
        [
          {
            "Rfc": "from"
          },
          {
            "start": 23,
            "end": 62
          }
        ],
        [
          {
            "Rfc": "to"
          },
          {
            "start": 65,
            "end": 95
          }
        ],
        [
          {
            "Rfc": "date"
          },
          {
            "start": 100,
            "end": 139
          }
        ],
        [
          {
            "Rfc": "subject"
          },
          {
            "start": 147,
            "end": 168
          }
        ],
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 181,
            "end": 238
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Multipart": [
          1,
          2,
          3,
          6,
          7
        ]
      },
      "offset_header": 0,
      "offset_body": 239,
      "offset_end": 1853
    },
    {
      "headers_rfc": {
        "content_type": {
          "ContentType": {
            "c_type": "text",
            "c_subtype": "plain",
            "attributes": null
          }
        }
      },
      "headers_raw": [],
      "is_encoding_problem": false,
      "body": {
        "Text": "... Some text appears here ...\n\n[Note that the blank between the boundary and the start\nof the text in this part means no header fields were\ngiven and this is text in the US-ASCII character set.\nIt could have been done with explicit typing as in the\nnext part.]\n"
      },
      "offset_header": 530,
      "offset_body": 531,
      "offset_end": 794
    },
    {
      "headers_rfc": {
        "content_type": {
          "ContentType": {
            "c_type": "text",
            "c_subtype": "plain",
            "attributes": {
              "charset": "US-ASCII"
            }
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 827,
            "end": 857
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Text": "This could have been part of the previous part, but\nillustrates explicit versus implicit typing of body\nparts.\n"
      },
      "offset_header": 814,
      "offset_body": 858,
      "offset_end": 970
    },
    {
      "headers_rfc": {
        "content_type": {
          "ContentType": {
            "c_type": "multipart",
            "c_subtype": "parallel",
            "attributes": {
              "boundary": "unique-boundary-2"
            }
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 1003,
            "end": 1051
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Multipart": [
          4,
          5
        ]
      },
      "offset_header": 990,
      "offset_body": 1052,
      "offset_end": 1366
    },
    {
      "headers_rfc": {
        "content_transfer_encoding": {
          "Text": "base64"
        },
        "content_type": {
          "ContentType": {
            "c_type": "audio",
            "c_subtype": "basic",
            "attributes": null
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 1085,
            "end": 1098
          }
        ],
        [
          {
            "Rfc": "content_transfer_encoding"
          },
          {
            "start": 1124,
            "end": 1132
          }
        ]
      ],
      "is_encoding_problem": true,
      "body": {
        "Text": "... base64-encoded 8000 Hz single-channel\n    mu-law-format audio data goes here ...\n"
      },
      "offset_header": 1072,
      "offset_body": 1133,
      "offset_end": 1219
    },
    {
      "headers_rfc": {
        "content_transfer_encoding": {
          "Text": "base64"
        },
        "content_type": {
          "ContentType": {
            "c_type": "image",
            "c_subtype": "jpeg",
            "attributes": null
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 1252,
            "end": 1264
          }
        ],
        [
          {
            "Rfc": "content_transfer_encoding"
          },
          {
            "start": 1290,
            "end": 1298
          }
        ]
      ],
      "is_encoding_problem": true,
      "body": {
        "Text": "... base64-encoded image data goes here ...\n"
      },
      "offset_header": 1239,
      "offset_body": 1299,
      "offset_end": 1344
    },
    {
      "headers_rfc": {
        "content_type": {
          "ContentType": {
            "c_type": "text",
            "c_subtype": "enriched",
            "attributes": null
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 1400,
            "end": 1415
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Text": "This is <bold><italic>enriched.</italic></bold>\n<smaller>as defined in RFC 1896</smaller>\n\nIsn't it\n<bigger><bigger>cool?</bigger></bigger>\n"
      },
      "offset_header": 1387,
      "offset_body": 1416,
      "offset_end": 1557
    },
    {
      "headers_rfc": {
        "content_type": {
          "ContentType": {
            "c_type": "message",
            "c_subtype": "rfc822",
            "attributes": null
          }
        }
      },
      "headers_raw": [
        [
          {
            "Rfc": "content_type"
          },
          {
            "start": 1590,
            "end": 1606
          }
        ]
      ],
      "is_encoding_problem": false,
      "body": {
        "Message": {
          "html_body": [
            0
          ],
          "text_body": [
            0
          ],
          "attachments": [],
          "parts": [
            {
              "headers_rfc": {
                "from": {
                  "Address": {
                    "name": "mailbox in US-ASCII",
                    "address": null
                  }
                },
                "content_transfer_encoding": {
                  "Text": "Quoted-printable"
                },
                "content_type": {
                  "ContentType": {
                    "c_type": "text",
                    "c_subtype": "plain",
                    "attributes": {
                      "charset": "ISO-8859-1"
                    }
                  }
                },
                "to": {
                  "Address": {
                    "name": "address in US-ASCII",
                    "address": null
                  }
                },
                "subject": {
                  "Text": "(subject in US-ASCII)"
                }
              },
              "is_encoding_problem": false,
              "body": {
                "Text": "... Additional text in ISO-8859-1 goes here ...\n"
              },
              "offset_header": 1607,
              "offset_body": 1782,
              "offset_end": 1831
            }
          ]
        }
      },
      "offset_header": 1577,
      "offset_body": 1607,
      "offset_end": 1831
    }
  ]
}