mirror of
https://github.com/stalwartlabs/mail-parser.git
synced 2026-12-05 08:01:26 +00:00
337 lines
6.8 KiB
Plaintext
337 lines
6.8 KiB
Plaintext
From: Moderator-Address <moderator>
|
|
Content-Type: multipart/digest; boundary=1;
|
|
|
|
|
|
--1
|
|
|
|
From: someone-else <someone@else>
|
|
Subject: my opinion
|
|
|
|
This is my opinion
|
|
--1
|
|
|
|
From: another one <another@one>
|
|
Subject: i disagree
|
|
|
|
Not agreeing one bit!
|
|
--1
|
|
|
|
From: attachment <attachment@user>
|
|
Subject: funny hat
|
|
Content-Type: multipart/mixed; boundary=2
|
|
|
|
--2
|
|
Content-Type: text/plain
|
|
Content-Transfer-Encoding: binary
|
|
|
|
Lovely attachment for you
|
|
--2
|
|
Content-Type: application/octet-stream; disposition=attachment; name="test.txt"
|
|
Content-Transfer-Encoding: binary
|
|
|
|
Foobar
|
|
--2--
|
|
--1--
|
|
---- EXPECTED STRUCTURE ----
|
|
{
|
|
"headers_rfc": {
|
|
"content_type": {
|
|
"ContentType": {
|
|
"c_type": "multipart",
|
|
"c_subtype": "digest",
|
|
"attributes": {
|
|
"boundary": "1"
|
|
}
|
|
}
|
|
},
|
|
"from": {
|
|
"Address": {
|
|
"name": "Moderator-Address",
|
|
"address": "moderator"
|
|
}
|
|
}
|
|
},
|
|
"headers_offsets": [
|
|
{
|
|
"name": {
|
|
"Rfc": "from"
|
|
},
|
|
"start": 5,
|
|
"end": 36
|
|
},
|
|
{
|
|
"name": {
|
|
"Rfc": "content_type"
|
|
},
|
|
"start": 49,
|
|
"end": 80
|
|
}
|
|
],
|
|
"attachments": [
|
|
0,
|
|
1,
|
|
2
|
|
],
|
|
"parts": [
|
|
{
|
|
"Message": {
|
|
"headers": {
|
|
"content_type": {
|
|
"ContentType": {
|
|
"c_type": "message",
|
|
"c_subtype": "rfc822"
|
|
}
|
|
}
|
|
},
|
|
"body": {
|
|
"headers_rfc": {
|
|
"subject": {
|
|
"Text": "my opinion"
|
|
},
|
|
"from": {
|
|
"Address": {
|
|
"name": "someone-else",
|
|
"address": "someone@else"
|
|
}
|
|
}
|
|
},
|
|
"headers_offsets": [
|
|
{
|
|
"name": {
|
|
"Rfc": "from"
|
|
},
|
|
"start": 92,
|
|
"end": 121
|
|
},
|
|
{
|
|
"name": {
|
|
"Rfc": "subject"
|
|
},
|
|
"start": 129,
|
|
"end": 141
|
|
}
|
|
],
|
|
"html_body": [
|
|
0
|
|
],
|
|
"text_body": [
|
|
0
|
|
],
|
|
"parts": [
|
|
{
|
|
"Text": {
|
|
"body": "This is my opinion"
|
|
}
|
|
}
|
|
],
|
|
"structure": {
|
|
"Part": 0
|
|
},
|
|
"offset_header": 87,
|
|
"offset_body": 142,
|
|
"offset_end": 166
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Message": {
|
|
"headers": {
|
|
"content_type": {
|
|
"ContentType": {
|
|
"c_type": "message",
|
|
"c_subtype": "rfc822"
|
|
}
|
|
}
|
|
},
|
|
"body": {
|
|
"headers_rfc": {
|
|
"from": {
|
|
"Address": {
|
|
"name": "another one",
|
|
"address": "another@one"
|
|
}
|
|
},
|
|
"subject": {
|
|
"Text": "i disagree"
|
|
}
|
|
},
|
|
"headers_offsets": [
|
|
{
|
|
"name": {
|
|
"Rfc": "from"
|
|
},
|
|
"start": 171,
|
|
"end": 198
|
|
},
|
|
{
|
|
"name": {
|
|
"Rfc": "subject"
|
|
},
|
|
"start": 206,
|
|
"end": 218
|
|
}
|
|
],
|
|
"html_body": [
|
|
0
|
|
],
|
|
"text_body": [
|
|
0
|
|
],
|
|
"parts": [
|
|
{
|
|
"Text": {
|
|
"body": "Not agreeing one bit!"
|
|
}
|
|
}
|
|
],
|
|
"structure": {
|
|
"Part": 0
|
|
},
|
|
"offset_header": 166,
|
|
"offset_body": 219,
|
|
"offset_end": 246
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"Message": {
|
|
"headers": {
|
|
"content_type": {
|
|
"ContentType": {
|
|
"c_type": "message",
|
|
"c_subtype": "rfc822"
|
|
}
|
|
}
|
|
},
|
|
"body": {
|
|
"headers_rfc": {
|
|
"from": {
|
|
"Address": {
|
|
"name": "attachment",
|
|
"address": "attachment@user"
|
|
}
|
|
},
|
|
"subject": {
|
|
"Text": "funny hat"
|
|
},
|
|
"content_type": {
|
|
"ContentType": {
|
|
"c_type": "multipart",
|
|
"c_subtype": "mixed",
|
|
"attributes": {
|
|
"boundary": "2"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"headers_offsets": [
|
|
{
|
|
"name": {
|
|
"Rfc": "from"
|
|
},
|
|
"start": 251,
|
|
"end": 281
|
|
},
|
|
{
|
|
"name": {
|
|
"Rfc": "subject"
|
|
},
|
|
"start": 289,
|
|
"end": 300
|
|
},
|
|
{
|
|
"name": {
|
|
"Rfc": "content_type"
|
|
},
|
|
"start": 313,
|
|
"end": 342
|
|
}
|
|
],
|
|
"html_body": [
|
|
0
|
|
],
|
|
"text_body": [
|
|
0
|
|
],
|
|
"attachments": [
|
|
1
|
|
],
|
|
"parts": [
|
|
{
|
|
"Text": {
|
|
"headers": {
|
|
"content_type": {
|
|
"ContentType": {
|
|
"c_type": "text",
|
|
"c_subtype": "plain"
|
|
}
|
|
},
|
|
"content_transfer_encoding": {
|
|
"Text": "binary"
|
|
}
|
|
},
|
|
"body": "Lovely attachment for you"
|
|
}
|
|
},
|
|
{
|
|
"Binary": {
|
|
"headers": {
|
|
"content_type": {
|
|
"ContentType": {
|
|
"c_type": "application",
|
|
"c_subtype": "octet-stream",
|
|
"attributes": {
|
|
"disposition": "attachment",
|
|
"name": "test.txt"
|
|
}
|
|
}
|
|
},
|
|
"content_transfer_encoding": {
|
|
"Text": "binary"
|
|
}
|
|
},
|
|
"body": [
|
|
70,
|
|
111,
|
|
111,
|
|
98,
|
|
97,
|
|
114
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"structure": {
|
|
"List": [
|
|
{
|
|
"Part": 0
|
|
},
|
|
{
|
|
"Part": 1
|
|
}
|
|
]
|
|
},
|
|
"offset_header": 246,
|
|
"offset_body": 343,
|
|
"offset_end": 565
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"structure": {
|
|
"List": [
|
|
{
|
|
"Part": 0
|
|
},
|
|
{
|
|
"Part": 1
|
|
},
|
|
{
|
|
"Part": 2
|
|
}
|
|
]
|
|
},
|
|
"offset_header": 0,
|
|
"offset_body": 82,
|
|
"offset_end": 570
|
|
} |