From: sender@example.com
To: recipient@example.com
Subject: Multipart Email Example
Content-Type: multipart/alternative; boundary="boundary-string"
--boundary-string
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Plain text email goes here!
This is the fallback if email client does not support HTML
--boundary-string
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<h1>This is the HTML Section!</h1>
<p>This is what displays in most modern email clients</p>
--boundary-string--
---- EXPECTED STRUCTURE ----
{
"headers_rfc": {
"to": {
"Address": {
"address": "recipient@example.com"
}
},
"from": {
"Address": {
"address": "sender@example.com"
}
},
"subject": {
"Text": "Multipart Email Example"
},
"content_type": {
"ContentType": {
"c_type": "multipart",
"c_subtype": "alternative",
"attributes": {
"boundary": "boundary-string"
}
}
}
},
"headers_offsets": [
{
"name": {
"Rfc": "from"
},
"start": 5,
"end": 25
},
{
"name": {
"Rfc": "to"
},
"start": 28,
"end": 51
},
{
"name": {
"Rfc": "subject"
},
"start": 59,
"end": 84
},
{
"name": {
"Rfc": "content_type"
},
"start": 97,
"end": 148
}
],
"html_body": [
1
],
"text_body": [
0
],
"parts": [
{
"Text": {
"headers": {
"content_transfer_encoding": {
"Text": "quoted-printable"
},
"content_disposition": {
"ContentType": {
"c_type": "inline"
}
},
"content_type": {
"ContentType": {
"c_type": "text",
"c_subtype": "plain",
"attributes": {
"charset": "utf-8"
}
}
}
},
"body": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n"
}
},
{
"Html": {
"headers": {
"content_disposition": {
"ContentType": {
"c_type": "inline"
}
},
"content_type": {
"ContentType": {
"c_type": "text",
"c_subtype": "html",
"attributes": {
"charset": "utf-8"
}
}
},
"content_transfer_encoding": {
"Text": "quoted-printable"
}
},
"body": "<h1>This is the HTML Section!</h1>\n<p>This is what displays in most modern email clients</p>\n"
}
}
],
"structure": {
"List": [
{
"Part": 0
},
{
"Part": 1
}
]
},
"offset_header": 0,
"offset_body": 149,
"offset_end": 615
}