From 02648905957cfc162e640c5f93eaf6ee221b54a2 Mon Sep 17 00:00:00 2001 From: Mauro D Date: Wed, 19 Apr 2023 15:09:37 +0000 Subject: [PATCH] First API tests. --- tests/Cargo.toml | 11 +- tests/resources/jmap_mail_get/headers.eml | 98 ++ tests/resources/jmap_mail_get/headers.json | 1292 +++++++++++++++++ .../jmap_mail_get/message_attachment.eml | 72 + .../jmap_mail_get/message_attachment.json | 155 ++ .../jmap_mail_get/multipart_alternative.eml | 22 + .../jmap_mail_get/multipart_alternative.json | 154 ++ .../resources/jmap_mail_get/multipart_cid.eml | 156 ++ .../jmap_mail_get/multipart_cid.json | 271 ++++ .../jmap_mail_get/multipart_mixed.eml | 72 + .../jmap_mail_get/multipart_mixed.json | 266 ++++ .../jmap_mail_get/multipart_related.eml | 198 +++ .../jmap_mail_get/multipart_related.json | 383 +++++ tests/resources/jmap_mail_get/rfc8621.eml | 72 + tests/resources/jmap_mail_get/rfc8621.json | 478 ++++++ tests/resources/jmap_mail_get/single_part.eml | 30 + .../resources/jmap_mail_get/single_part.json | 224 +++ .../jmap_mail_get/text_body_missing.eml | 43 + .../jmap_mail_get/text_body_missing.json | 165 +++ .../text_body_missing_multipart.eml | 83 ++ .../text_body_missing_multipart.json | 177 +++ .../resources/jmap_mail_parse/attachment.eml | 72 + .../resources/jmap_mail_parse/attachment.json | 187 +++ .../jmap_mail_parse/attachment.part1 | 13 + .../jmap_mail_parse/attachment.part2 | Bin 0 -> 288 bytes .../jmap_mail_parse/attachment.part3 | 1 + .../jmap_mail_parse/attachment_b64.eml | 30 + .../jmap_mail_parse/attachment_b64.json | 127 ++ .../jmap_mail_parse/attachment_b64.part1 | 1 + .../jmap_mail_parse/attachment_b64.part2 | 8 + tests/resources/jmap_mail_parse/headers.eml | 98 ++ tests/resources/jmap_mail_parse/headers.json | 1257 ++++++++++++++++ tests/resources/jmap_mail_set/headers.eml | 51 + tests/resources/jmap_mail_set/headers.jmap | 304 ++++ tests/resources/jmap_mail_set/headers.json | 186 +++ tests/resources/jmap_mail_set/minimal.eml | 6 + tests/resources/jmap_mail_set/minimal.jmap | 100 ++ tests/resources/jmap_mail_set/minimal.json | 7 + tests/resources/jmap_mail_set/mixed.eml | 50 + tests/resources/jmap_mail_set/mixed.jmap | 329 +++++ tests/resources/jmap_mail_set/mixed.json | 70 + tests/resources/jmap_mail_set/nested_body.eml | 98 ++ .../resources/jmap_mail_set/nested_body.jmap | 592 ++++++++ .../resources/jmap_mail_set/nested_body.json | 89 ++ tests/resources/jmap_mail_set/rfc8621_1.eml | 9 + tests/resources/jmap_mail_set/rfc8621_1.jmap | 155 ++ tests/resources/jmap_mail_set/rfc8621_1.json | 29 + tests/resources/jmap_mail_set/rfc8621_2.eml | 22 + tests/resources/jmap_mail_set/rfc8621_2.jmap | 174 +++ tests/resources/jmap_mail_set/rfc8621_2.json | 49 + tests/resources/jmap_mail_snippet/html.eml | 35 + tests/resources/jmap_mail_snippet/mixed.eml | 77 + tests/resources/jmap_mail_snippet/subpart.eml | 72 + .../jmap_mail_snippet/text_plain.eml | 19 + .../jmap_mail_snippet/text_plain_chinese.eml | 17 + .../jmap_sieve/test_discard_reject.sieve | 41 + tests/resources/jmap_sieve/test_include.sieve | 5 + .../jmap_sieve/test_include_this.sieve | 4 + tests/resources/jmap_sieve/test_mailbox.sieve | 63 + .../jmap_sieve/test_notify_fcc.sieve | 13 + .../jmap_sieve/test_redirect_enclose.sieve | 5 + .../resources/jmap_sieve/validate_error.sieve | 1 + tests/resources/jmap_sieve/validate_ok.sieve | 3 + tests/resources/tls_cert.pem | 29 + tests/resources/tls_privatekey.pem | 52 + tests/src/jmap/email_get.rs | 353 +++++ tests/src/jmap/mod.rs | 149 ++ tests/src/lib.rs | 18 + tests/src/store/mod.rs | 22 +- tests/src/store/query.rs | 7 +- 70 files changed, 9506 insertions(+), 15 deletions(-) create mode 100644 tests/resources/jmap_mail_get/headers.eml create mode 100644 tests/resources/jmap_mail_get/headers.json create mode 100644 tests/resources/jmap_mail_get/message_attachment.eml create mode 100644 tests/resources/jmap_mail_get/message_attachment.json create mode 100644 tests/resources/jmap_mail_get/multipart_alternative.eml create mode 100644 tests/resources/jmap_mail_get/multipart_alternative.json create mode 100644 tests/resources/jmap_mail_get/multipart_cid.eml create mode 100644 tests/resources/jmap_mail_get/multipart_cid.json create mode 100644 tests/resources/jmap_mail_get/multipart_mixed.eml create mode 100644 tests/resources/jmap_mail_get/multipart_mixed.json create mode 100644 tests/resources/jmap_mail_get/multipart_related.eml create mode 100644 tests/resources/jmap_mail_get/multipart_related.json create mode 100644 tests/resources/jmap_mail_get/rfc8621.eml create mode 100644 tests/resources/jmap_mail_get/rfc8621.json create mode 100644 tests/resources/jmap_mail_get/single_part.eml create mode 100644 tests/resources/jmap_mail_get/single_part.json create mode 100644 tests/resources/jmap_mail_get/text_body_missing.eml create mode 100644 tests/resources/jmap_mail_get/text_body_missing.json create mode 100644 tests/resources/jmap_mail_get/text_body_missing_multipart.eml create mode 100644 tests/resources/jmap_mail_get/text_body_missing_multipart.json create mode 100644 tests/resources/jmap_mail_parse/attachment.eml create mode 100644 tests/resources/jmap_mail_parse/attachment.json create mode 100644 tests/resources/jmap_mail_parse/attachment.part1 create mode 100644 tests/resources/jmap_mail_parse/attachment.part2 create mode 100644 tests/resources/jmap_mail_parse/attachment.part3 create mode 100644 tests/resources/jmap_mail_parse/attachment_b64.eml create mode 100644 tests/resources/jmap_mail_parse/attachment_b64.json create mode 100644 tests/resources/jmap_mail_parse/attachment_b64.part1 create mode 100644 tests/resources/jmap_mail_parse/attachment_b64.part2 create mode 100644 tests/resources/jmap_mail_parse/headers.eml create mode 100644 tests/resources/jmap_mail_parse/headers.json create mode 100644 tests/resources/jmap_mail_set/headers.eml create mode 100644 tests/resources/jmap_mail_set/headers.jmap create mode 100644 tests/resources/jmap_mail_set/headers.json create mode 100644 tests/resources/jmap_mail_set/minimal.eml create mode 100644 tests/resources/jmap_mail_set/minimal.jmap create mode 100644 tests/resources/jmap_mail_set/minimal.json create mode 100644 tests/resources/jmap_mail_set/mixed.eml create mode 100644 tests/resources/jmap_mail_set/mixed.jmap create mode 100644 tests/resources/jmap_mail_set/mixed.json create mode 100644 tests/resources/jmap_mail_set/nested_body.eml create mode 100644 tests/resources/jmap_mail_set/nested_body.jmap create mode 100644 tests/resources/jmap_mail_set/nested_body.json create mode 100644 tests/resources/jmap_mail_set/rfc8621_1.eml create mode 100644 tests/resources/jmap_mail_set/rfc8621_1.jmap create mode 100644 tests/resources/jmap_mail_set/rfc8621_1.json create mode 100644 tests/resources/jmap_mail_set/rfc8621_2.eml create mode 100644 tests/resources/jmap_mail_set/rfc8621_2.jmap create mode 100644 tests/resources/jmap_mail_set/rfc8621_2.json create mode 100644 tests/resources/jmap_mail_snippet/html.eml create mode 100644 tests/resources/jmap_mail_snippet/mixed.eml create mode 100644 tests/resources/jmap_mail_snippet/subpart.eml create mode 100644 tests/resources/jmap_mail_snippet/text_plain.eml create mode 100644 tests/resources/jmap_mail_snippet/text_plain_chinese.eml create mode 100644 tests/resources/jmap_sieve/test_discard_reject.sieve create mode 100644 tests/resources/jmap_sieve/test_include.sieve create mode 100644 tests/resources/jmap_sieve/test_include_this.sieve create mode 100644 tests/resources/jmap_sieve/test_mailbox.sieve create mode 100644 tests/resources/jmap_sieve/test_notify_fcc.sieve create mode 100644 tests/resources/jmap_sieve/test_redirect_enclose.sieve create mode 100644 tests/resources/jmap_sieve/validate_error.sieve create mode 100644 tests/resources/jmap_sieve/validate_ok.sieve create mode 100644 tests/resources/tls_cert.pem create mode 100644 tests/resources/tls_privatekey.pem create mode 100644 tests/src/jmap/email_get.rs create mode 100644 tests/src/jmap/mod.rs diff --git a/tests/Cargo.toml b/tests/Cargo.toml index fab41e99..c6bfab8a 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -2,14 +2,21 @@ name = "tests" version = "0.1.0" edition = "2021" +resolver = "2" [dependencies] store = { path = "../crates/store", features = ["test_mode"] } +jmap = { path = "../crates/jmap" } +jmap_proto = { path = "../crates/jmap-proto" } utils = { path = "../crates/utils" } - -[dev-dependencies] +jmap-client = { git = "https://github.com/stalwartlabs/jmap-client", features = ["websockets", "debug", "async"] } +mail-parser = { git = "https://github.com/stalwartlabs/mail-parser", features = ["full_encoding", "serde_support", "ludicrous_mode"] } tokio = { version = "1.23", features = ["full"] } csv = "1.1" rayon = { version = "1.5.1" } flate2 = { version = "1.0.17", features = ["zlib"], default-features = false } +serde = { version = "1.0", features = ["derive"]} +serde_json = "1.0" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/tests/resources/jmap_mail_get/headers.eml b/tests/resources/jmap_mail_get/headers.eml new file mode 100644 index 00000000..11983a6a --- /dev/null +++ b/tests/resources/jmap_mail_get/headers.eml @@ -0,0 +1,98 @@ +From: Art Vandelay (Vandelay Industries) +To: " James Smythe" , Friends: + jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= + ; +Cc: List 1: addr1@test.com, addr2@test.com; List 2: addr3@test.com, + addr4@test.com; addr5@test.com, addr6@test.com +Cc: =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: addr1@test.com, + addr2@test.com; =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: + addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com +Bcc: Greg Vaudreuil , Ned Freed + , Keith Moore +Bcc: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se +Date: Tue, 1 Jul 2003 10:52:37 +0200 +Resent-Date: Tue, 2 Jul 2005 11:52:37 +0200 +Resent-Date: Tue, 3 Jul 2005 12:52:37 +0300 +Resent-Date: Tue, 4 Jul 2005 13:52:37 +0400 +Message-ID: <5678.21-Nov-1997@example.com> +References: <1234@local.machine.example> + <3456@example.net> +References: <789@local.machine.example> + +Keywords: multipart, alternative, example +List-Post: (Postings are Moderated) +List-Subscribe: (Use this command to join the list) + +List-Subscribe: (FTP), + +List-Owner: , + +List-Unsubscribe: (Use this command to get off the list) + +Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?= +X-Address-Single: =?ISO-8859-1?Q?Andr=E9?= Pirard +X-Address: Mary Smith +X-Address: John Doe +X-AddressList-Single: Mary Smith , jdoe@example.org, Who? +X-AddressList: =?US-ASCII*EN?Q?Keith_Moore?= , + John =?US-ASCII*EN?Q?Doe?= +X-AddressList: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= , + =?ISO-8859-1?Q?Olle_J=E4rnefors?= +X-AddressesGroup-Single: A Group(Some people) + :Chris Jones , + joe@example.org, John (my dear + friend); (the end of the group) +X-AddressesGroup: A Group:Ed Jones ,joe@where.test,John ; +X-AddressesGroup: "List 1": addr1@test.com, addr2@test.com; "List 2": + addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com +X-List-Single: (X-Postings are Moderated) +X-List: , + +X-List: , + +X-Text-Single: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= + =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?= +X-Text: =?iso-8859-1?q?this=20is=20some=20text?= +X-Text: =?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?= +X-Date-Single: Tue, 5 Jul 2006 13:52:37 -0500 +X-Date: Sat, 20 Nov 2021 14:22:01 -0800 +X-Date: Sun, 21 Nov 2021 15:23:02 -0900 +X-Id-Single: +X-Id: +X-Id: +Content-Type: multipart/mixed; boundary="festivus"; + +--festivus +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: base64 +X-Custom-Header: 123 + +PGh0bWw+PHA+SSB3YXMgdGhpbmtpbmcgYWJvdXQgcXVpdHRpbmcgdGhlICZsZHF1bztle +HBvcnRpbmcmcmRxdW87IHRvIGZvY3VzIGp1c3Qgb24gdGhlICZsZHF1bztpbXBvcnRpbm +cmcmRxdW87LDwvcD48cD5idXQgdGhlbiBJIHRob3VnaHQsIHdoeSBub3QgZG8gYm90aD8 +gJiN4MjYzQTs8L3A+PC9odG1sPg== +--festivus +Content-Type: message/rfc822 +X-Custom-Header-2: 345 + +From: "Cosmo Kramer" +Subject: Exporting my book about coffee tables +Content-Type: multipart/mixed; boundary="giddyup"; + +--giddyup +Content-Type: text/plain; charset="utf-16" +Content-Transfer-Encoding: quoted-printable + +=FF=FE=0C!5=D8"=DD5=D8)=DD5=D8-=DD =005=D8*=DD5=D8"=DD =005=D8"= +=DD5=D85=DD5=D8-=DD5=D8,=DD5=D8/=DD5=D81=DD =005=D8*=DD5=D86=DD = +=005=D8=1F=DD5=D8,=DD5=D8,=DD5=D8(=DD =005=D8-=DD5=D8)=DD5=D8"= +=DD5=D8=1E=DD5=D80=DD5=D8"=DD!=00 +--giddyup +Content-Type: image/gif; name*1="about "; name*0="Book "; + name*2*=utf-8''%e2%98%95 tables.gif +Content-Transfer-Encoding: Base64 +Content-Disposition: attachment + +R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +--giddyup-- +--festivus-- diff --git a/tests/resources/jmap_mail_get/headers.json b/tests/resources/jmap_mail_get/headers.json new file mode 100644 index 00000000..f8248125 --- /dev/null +++ b/tests/resources/jmap_mail_get/headers.json @@ -0,0 +1,1292 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 4535, + "receivedAt": "2113-09-16T10:13:20Z", + "messageId": [ + "5678.21-Nov-1997@example.com" + ], + "references": [ + "789@local.machine.example", + "abcd@example.net" + ], + "from": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ], + "to": [ + { + "name": " James Smythe", + "email": "james@example.com" + }, + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ], + "cc": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + "bcc": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ], + "subject": "Why not both importing AND exporting? ☺", + "sentAt": "2003-07-01T08:52:37Z", + "bodyStructure": { + "size": 0, + "type": "multipart/mixed", + "subParts": [ + { + "partId": "1", + "size": 175, + "type": "text/html", + "charset": "us-ascii" + }, + { + "partId": "2", + "size": 723, + "type": "message/rfc822" + } + ] + }, + "bodyValues": { + "1": { + "value": "

I was thinking about quitting the “exporting” to focus just on the “im...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "1", + "size": 175, + "type": "text/html", + "charset": "us-ascii" + } + ], + "htmlBody": [ + { + "partId": "1", + "size": 175, + "type": "text/html", + "charset": "us-ascii" + } + ], + "attachments": [ + { + "partId": "2", + "size": 723, + "type": "message/rfc822" + } + ], + "hasAttachment": true, + "preview": "I was thinking about quitting the “exporting” to focus just on the “importing”,\nbut then I thought, why not do both? ☺\n", + "header:Bcc": " ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se", + "header:Bcc:all": [ + " Greg Vaudreuil , Ned Freed\n , Keith Moore ", + " ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se" + ], + "header:Bcc:asAddresses": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ], + "header:Bcc:asAddresses:all": [ + [ + { + "name": "Greg Vaudreuil", + "email": "gvaudre@NRI.Reston.VA.US" + }, + { + "name": "Ned Freed", + "email": "ned@innosoft.com" + }, + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + } + ], + [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ] + ], + "header:Bcc:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ] + } + ], + "header:Bcc:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Greg Vaudreuil", + "email": "gvaudre@NRI.Reston.VA.US" + }, + { + "name": "Ned Freed", + "email": "ned@innosoft.com" + }, + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + } + ] + } + ], + [ + { + "name": null, + "addresses": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ] + } + ] + ], + "header:Cc": " =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: addr1@test.com, \n addr2@test.com; =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com", + "header:Cc:all": [ + " List 1: addr1@test.com, addr2@test.com; List 2: addr3@test.com, \n addr4@test.com; addr5@test.com, addr6@test.com", + " =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: addr1@test.com, \n addr2@test.com; =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com" + ], + "header:Cc:asAddresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + "header:Cc:asAddresses:all": [ + [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + ], + "header:Cc:asGroupedAddresses": [ + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ], + "header:Cc:asGroupedAddresses:all": [ + [ + { + "name": "List 1", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "List 2", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ], + [ + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ] + ], + "header:Date": " Tue, 1 Jul 2003 10:52:37 +0200", + "header:Date:all": [ + " Tue, 1 Jul 2003 10:52:37 +0200" + ], + "header:Date:asDate": "2003-07-01T08:52:37Z", + "header:Date:asDate:all": [ + "2003-07-01T08:52:37Z" + ], + "header:From": " Art Vandelay (Vandelay Industries)", + "header:From:all": [ + " Art Vandelay (Vandelay Industries)" + ], + "header:From:asAddresses": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ], + "header:From:asAddresses:all": [ + [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ] + ], + "header:From:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ] + } + ], + "header:From:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ] + } + ] + ], + "header:Keywords": " multipart, alternative, example", + "header:Keywords:all": [ + " multipart, alternative, example" + ], + "header:Keywords:asText": "multipart, alternative, example", + "header:Keywords:asText:all": [ + "multipart, alternative, example" + ], + "header:List-Owner": " ,\n ", + "header:List-Owner:all": [ + " ,\n " + ], + "header:List-Owner:asURLs": [ + "http://www.host.com/list.cgi?cmd=sub&lst=list", + "mailto:list-manager@host.com?body=subscribe%20list" + ], + "header:List-Owner:asURLs:all": [ + [ + "http://www.host.com/list.cgi?cmd=sub&lst=list", + "mailto:list-manager@host.com?body=subscribe%20list" + ] + ], + "header:List-Post": " (Postings are Moderated)", + "header:List-Post:all": [ + " (Postings are Moderated)" + ], + "header:List-Post:asURLs": [ + "mailto:moderator@host.com" + ], + "header:List-Post:asURLs:all": [ + [ + "mailto:moderator@host.com" + ] + ], + "header:List-Subscribe": " (FTP), \n ", + "header:List-Subscribe:all": [ + " (Use this command to join the list)\n ", + " (FTP), \n " + ], + "header:List-Subscribe:asURLs": [ + "ftp://ftp.host.com/list.txt", + "mailto:list@host.com?subject=subscribe" + ], + "header:List-Subscribe:asURLs:all": [ + [ + "mailto:list-manager@host.com?body=subscribe%20list" + ], + [ + "ftp://ftp.host.com/list.txt", + "mailto:list@host.com?subject=subscribe" + ] + ], + "header:List-Unsubscribe": " (Use this command to get off the list)\n ", + "header:List-Unsubscribe:all": [ + " (Use this command to get off the list)\n " + ], + "header:List-Unsubscribe:asURLs": [ + "mailto:list-manager@host.com?body=unsubscribe%20list" + ], + "header:List-Unsubscribe:asURLs:all": [ + [ + "mailto:list-manager@host.com?body=unsubscribe%20list" + ] + ], + "header:Message-ID": " <5678.21-Nov-1997@example.com>", + "header:Message-ID:all": [ + " <5678.21-Nov-1997@example.com>" + ], + "header:Message-ID:asMessageIds": [ + "5678.21-Nov-1997@example.com" + ], + "header:Message-ID:asMessageIds:all": [ + [ + "5678.21-Nov-1997@example.com" + ] + ], + "header:References": " <789@local.machine.example>\n ", + "header:References:all": [ + " <1234@local.machine.example>\n <3456@example.net>", + " <789@local.machine.example>\n " + ], + "header:References:asMessageIds": [ + "789@local.machine.example", + "abcd@example.net" + ], + "header:References:asMessageIds:all": [ + [ + "1234@local.machine.example", + "3456@example.net" + ], + [ + "789@local.machine.example", + "abcd@example.net" + ] + ], + "header:Resent-Date": " Tue, 4 Jul 2005 13:52:37 +0400", + "header:Resent-Date:all": [ + " Tue, 2 Jul 2005 11:52:37 +0200", + " Tue, 3 Jul 2005 12:52:37 +0300", + " Tue, 4 Jul 2005 13:52:37 +0400" + ], + "header:Resent-Date:asDate": "2005-07-04T09:52:37Z", + "header:Resent-Date:asDate:all": [ + "2005-07-02T09:52:37Z", + "2005-07-03T09:52:37Z", + "2005-07-04T09:52:37Z" + ], + "header:Subject": " Why not both importing AND exporting? =?utf-8?b?4pi6?=", + "header:Subject:all": [ + " Why not both importing AND exporting? =?utf-8?b?4pi6?=" + ], + "header:Subject:asText": "Why not both importing AND exporting? ☺", + "header:Subject:asText:all": [ + "Why not both importing AND exporting? ☺" + ], + "header:To": " \" James Smythe\" , Friends:\n jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?=\n ;", + "header:To:all": [ + " \" James Smythe\" , Friends:\n jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?=\n ;" + ], + "header:To:asAddresses": [ + { + "name": " James Smythe", + "email": "james@example.com" + }, + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ], + "header:To:asAddresses:all": [ + [ + { + "name": " James Smythe", + "email": "james@example.com" + }, + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ] + ], + "header:To:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": " James Smythe", + "email": "james@example.com" + } + ] + }, + { + "name": "Friends", + "addresses": [ + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ] + } + ], + "header:To:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": " James Smythe", + "email": "james@example.com" + } + ] + }, + { + "name": "Friends", + "addresses": [ + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ] + } + ] + ], + "header:X-Address": " John Doe ", + "header:X-Address:all": [ + " Mary Smith ", + " John Doe " + ], + "header:X-Address:asAddresses": [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ], + "header:X-Address:asAddresses:all": [ + [ + { + "name": "Mary Smith", + "email": "mary@example.net" + } + ], + [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ] + ], + "header:X-Address:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ] + } + ], + "header:X-Address:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Mary Smith", + "email": "mary@example.net" + } + ] + } + ], + [ + { + "name": null, + "addresses": [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ] + } + ] + ], + "header:X-Address-Single": " =?ISO-8859-1?Q?Andr=E9?= Pirard ", + "header:X-Address-Single:all": [ + " =?ISO-8859-1?Q?Andr=E9?= Pirard " + ], + "header:X-Address-Single:asAddresses": [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ], + "header:X-Address-Single:asAddresses:all": [ + [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ] + ], + "header:X-Address-Single:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ] + } + ], + "header:X-Address-Single:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ] + } + ] + ], + "header:X-AddressList": " =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= ,\n =?ISO-8859-1?Q?Olle_J=E4rnefors?= ", + "header:X-AddressList:all": [ + " =?US-ASCII*EN?Q?Keith_Moore?= , \n John =?US-ASCII*EN?Q?Doe?= ", + " =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= ,\n =?ISO-8859-1?Q?Olle_J=E4rnefors?= " + ], + "header:X-AddressList:asAddresses": [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ], + "header:X-AddressList:asAddresses:all": [ + [ + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + }, + { + "name": "John Doe", + "email": "moore@cs.utk.edu" + } + ], + [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ] + ], + "header:X-AddressList:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ] + } + ], + "header:X-AddressList:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + }, + { + "name": "John Doe", + "email": "moore@cs.utk.edu" + } + ] + } + ], + [ + { + "name": null, + "addresses": [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ] + } + ] + ], + "header:X-AddressList-Single": " Mary Smith , jdoe@example.org, Who? ", + "header:X-AddressList-Single:all": [ + " Mary Smith , jdoe@example.org, Who? " + ], + "header:X-AddressList-Single:asAddresses": [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ], + "header:X-AddressList-Single:asAddresses:all": [ + [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ] + ], + "header:X-AddressList-Single:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ] + } + ], + "header:X-AddressList-Single:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ] + } + ] + ], + "header:X-AddressesGroup": " \"List 1\": addr1@test.com, addr2@test.com; \"List 2\": \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com", + "header:X-AddressesGroup:all": [ + " A Group:Ed Jones ,joe@where.test,John ;", + " \"List 1\": addr1@test.com, addr2@test.com; \"List 2\": \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com" + ], + "header:X-AddressesGroup:asAddresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + "header:X-AddressesGroup:asAddresses:all": [ + [ + { + "name": "Ed Jones", + "email": "c@a.test" + }, + { + "name": null, + "email": "joe@where.test" + }, + { + "name": "John", + "email": "jdoe@one.test" + } + ], + [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + ], + "header:X-AddressesGroup:asGroupedAddresses": [ + { + "name": "List 1", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "List 2", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ], + "header:X-AddressesGroup:asGroupedAddresses:all": [ + [ + { + "name": "A Group", + "addresses": [ + { + "name": "Ed Jones", + "email": "c@a.test" + }, + { + "name": null, + "email": "joe@where.test" + }, + { + "name": "John", + "email": "jdoe@one.test" + } + ] + } + ], + [ + { + "name": "List 1", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "List 2", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ] + ], + "header:X-AddressesGroup-Single": " A Group(Some people)\n :Chris Jones ,\n joe@example.org, John (my dear\n friend); (the end of the group)", + "header:X-AddressesGroup-Single:all": [ + " A Group(Some people)\n :Chris Jones ,\n joe@example.org, John (my dear\n friend); (the end of the group)" + ], + "header:X-AddressesGroup-Single:asAddresses": [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ], + "header:X-AddressesGroup-Single:asAddresses:all": [ + [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ] + ], + "header:X-AddressesGroup-Single:asGroupedAddresses": [ + { + "name": "A Group (Some people)", + "addresses": [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ] + }, + { + "name": null, + "addresses": [] + } + ], + "header:X-AddressesGroup-Single:asGroupedAddresses:all": [ + [ + { + "name": "A Group (Some people)", + "addresses": [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ] + }, + { + "name": null, + "addresses": [] + } + ] + ], + "header:X-Date": " Sun, 21 Nov 2021 15:23:02 -0900", + "header:X-Date:all": [ + " Sat, 20 Nov 2021 14:22:01 -0800", + " Sun, 21 Nov 2021 15:23:02 -0900" + ], + "header:X-Date:asDate": "2021-11-22T00:23:02Z", + "header:X-Date:asDate:all": [ + "2021-11-20T22:22:01Z", + "2021-11-22T00:23:02Z" + ], + "header:X-Date-Single": " Tue, 5 Jul 2006 13:52:37 -0500", + "header:X-Date-Single:all": [ + " Tue, 5 Jul 2006 13:52:37 -0500" + ], + "header:X-Date-Single:asDate": "2006-07-05T18:52:37Z", + "header:X-Date-Single:asDate:all": [ + "2006-07-05T18:52:37Z" + ], + "header:X-Id": " ", + "header:X-Id:all": [ + " ", + " " + ], + "header:X-Id:asMessageIds": [ + "myid4@example.com", + "myid5@example.com" + ], + "header:X-Id:asMessageIds:all": [ + [ + "myid3@example.com" + ], + [ + "myid4@example.com", + "myid5@example.com" + ] + ], + "header:X-Id-Single": " ", + "header:X-Id-Single:all": [ + " " + ], + "header:X-Id-Single:asMessageIds": [ + "myid@example.com", + "myid2@example.com" + ], + "header:X-Id-Single:asMessageIds:all": [ + [ + "myid@example.com", + "myid2@example.com" + ] + ], + "header:X-List": " ,\n ", + "header:X-List:all": [ + " ,\n ", + " ,\n " + ], + "header:X-List:asURLs": [ + "http://www.mylist2.com/list2", + "mailto:list2@mylist2.com" + ], + "header:X-List:asURLs:all": [ + [ + "http://www.mylist.com/list", + "mailto:list@mylist.com" + ], + [ + "http://www.mylist2.com/list2", + "mailto:list2@mylist2.com" + ] + ], + "header:X-List-Single": " (X-Postings are Moderated)", + "header:X-List-Single:all": [ + " (X-Postings are Moderated)" + ], + "header:X-List-Single:asURLs": [ + "mailto:x-moderator@host.com" + ], + "header:X-List-Single:asURLs:all": [ + [ + "mailto:x-moderator@host.com" + ] + ], + "header:X-Text": " =?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=", + "header:X-Text:all": [ + " =?iso-8859-1?q?this=20is=20some=20text?=", + " =?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=" + ], + "header:X-Text:asText": "a b", + "header:X-Text:asText:all": [ + "this is some text", + "a b" + ], + "header:X-Text-Single": " =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\n =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=", + "header:X-Text-Single:all": [ + " =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\n =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=" + ], + "header:X-Text-Single:asText": "If you can read this you understand the example.", + "header:X-Text-Single:asText:all": [ + "If you can read this you understand the example." + ] +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/message_attachment.eml b/tests/resources/jmap_mail_get/message_attachment.eml new file mode 100644 index 00000000..042e0623 --- /dev/null +++ b/tests/resources/jmap_mail_get/message_attachment.eml @@ -0,0 +1,72 @@ +From: Al Gore +To: White House Transportation Coordinator + +Subject: [Fwd: Map of Argentina with Description] +Content-Type: multipart/mixed; + boundary="D7F------------D7FD5A0B8AB9C65CCDBFA872" + +This is a multi-part message in MIME format. +--D7F------------D7FD5A0B8AB9C65CCDBFA872 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit + +Fred, + +Fire up Air Force One! We're going South! + +Thanks, +Al +--D7F------------D7FD5A0B8AB9C65CCDBFA872 +Content-Type: message/rfc822 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Return-Path: +Received: from mailhost.whitehouse.gov ([192.168.51.200]) + by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453 + for ; + Mon, 13 Aug 1998 l8:14:23 +1000 +Received: from the_big_box.whitehouse.gov ([192.168.51.50]) + by mailhost.whitehouse.gov (8.8.8/8.8.7) with ESMTP id RAA20366 + for vice-president@whitehouse.gov; Mon, 13 Aug 1998 17:42:41 +1000 +Date: Mon, 13 Aug 1998 17:42:41 +1000 +Message-Id: <199804130742.RAA20366@mai1host.whitehouse.gov> +From: Bill Clinton +To: A1 (The Enforcer) Gore +Subject: Map of Argentina with Description +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="DC8------------DC8638F443D87A7F0726DEF7" + +This is a multi-part message in MIME format. +--DC8------------DC8638F443D87A7F0726DEF7 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit + +Hi A1, + +I finally figured out this MIME thing. Pretty cool. I'll send you +some sax music in .au files next week! + +Anyway, the attached image is really too small to get a good look at +Argentina. Try this for a much better map: + + http://www.1one1yp1anet.com/dest/sam/graphics/map-arg.htm + +Then again, shouldn't the CIA have something like that? + +Bill +--DC8------------DC8638F443D87A7F0726DEF7 +Content-Type: image/gif; name="map_of_Argentina.gif" +Content-Transfer-Encoding: base64 +Content-Disposition: inline; fi1ename="map_of_Argentina.gif" + +R01GOD1hJQA1AKIAAP/////78P/omn19fQAAAAAAAAAAAAAAACwAAAAAJQA1AAAD7Qi63P5w +wEmjBCLrnQnhYCgM1wh+pkgqqeC9XrutmBm7hAK3tP31gFcAiFKVQrGFR6kscnonTe7FAAad +GugmRu3CmiBt57fsVq3Y0VFKnpYdxPC6M7Ze4crnnHum4oN6LFJ1bn5NXTN7OF5fQkN5WYow +BEN2dkGQGWJtSzqGTICJgnQuTJN/WJsojad9qXMuhIWdjXKjY4tenjo6tjVssk2gaWq3uGNX +U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz +7itICBxISKDBgwgTKjyYAAA7 +--DC8------------DC8638F443D87A7F0726DEF7-- + +--D7F------------D7FD5A0B8AB9C65CCDBFA872-- diff --git a/tests/resources/jmap_mail_get/message_attachment.json b/tests/resources/jmap_mail_get/message_attachment.json new file mode 100644 index 00000000..b2f8ad79 --- /dev/null +++ b/tests/resources/jmap_mail_get/message_attachment.json @@ -0,0 +1,155 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 2651, + "receivedAt": "2054-01-02T20:53:20Z", + "from": [ + { + "name": "Al Gore", + "email": "vice-president@whitehouse.gov" + } + ], + "to": [ + { + "name": "White House Transportation Coordinator", + "email": "transport@whitehouse.gov" + } + ], + "subject": "[Fwd: Map of Argentina with Description]", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "From", + "value": " Al Gore " + }, + { + "name": "To", + "value": " White House Transportation Coordinator\n " + }, + { + "name": "Subject", + "value": " [Fwd: Map of Argentina with Description]" + }, + { + "name": "Content-Type", + "value": " multipart/mixed;\n boundary=\"D7F------------D7FD5A0B8AB9C65CCDBFA872\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 61, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=us-ascii" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 1979, + "headers": [ + { + "name": "Content-Type", + "value": " message/rfc822" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "message/rfc822", + "disposition": "inline" + } + ] + }, + "bodyValues": { + "1": { + "value": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 61, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=us-ascii" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii" + } + ], + "htmlBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 61, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=us-ascii" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii" + } + ], + "attachments": [ + { + "partId": "2", + "blobId": "blob_1", + "size": 1979, + "headers": [ + { + "name": "Content-Type", + "value": " message/rfc822" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "message/rfc822", + "disposition": "inline" + } + ], + "hasAttachment": true, + "preview": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/multipart_alternative.eml b/tests/resources/jmap_mail_get/multipart_alternative.eml new file mode 100644 index 00000000..cd063599 --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_alternative.eml @@ -0,0 +1,22 @@ +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 + +

This is the HTML Section!

+

This is what displays in most modern email clients

+ +--boundary-string-- diff --git a/tests/resources/jmap_mail_get/multipart_alternative.json b/tests/resources/jmap_mail_get/multipart_alternative.json new file mode 100644 index 00000000..7e6a0392 --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_alternative.json @@ -0,0 +1,154 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 616, + "receivedAt": "1989-07-09T15:06:40Z", + "from": [ + { + "name": null, + "email": "sender@example.com" + } + ], + "to": [ + { + "name": null, + "email": "recipient@example.com" + } + ], + "subject": "Multipart Email Example", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "From", + "value": " sender@example.com" + }, + { + "name": "To", + "value": " recipient@example.com" + }, + { + "name": "Subject", + "value": " Multipart Email Example" + }, + { + "name": "Content-Type", + "value": " multipart/alternative; boundary=\"boundary-string\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 87, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "utf-8", + "disposition": "inline" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 93, + "headers": [ + { + "name": "Content-Type", + "value": " text/html; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/html", + "charset": "utf-8", + "disposition": "inline" + } + ] + }, + "bodyValues": { + "1": { + "value": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n", + "isEncodingProblem": false, + "isTruncated": false + }, + "2": { + "value": "

This is the HTML Section!

\n

This is what displays in most modern email clients

\n", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 87, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "utf-8", + "disposition": "inline" + } + ], + "htmlBody": [ + { + "partId": "2", + "blobId": "blob_1", + "size": 93, + "headers": [ + { + "name": "Content-Type", + "value": " text/html; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/html", + "charset": "utf-8", + "disposition": "inline" + } + ], + "attachments": [], + "hasAttachment": false, + "preview": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/multipart_cid.eml b/tests/resources/jmap_mail_get/multipart_cid.eml new file mode 100644 index 00000000..d7faea0f --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_cid.eml @@ -0,0 +1,156 @@ +From: "Doug Sauder" +To: "Joe Blow" +Subject: Test message from Microsoft Outlook 00 +Date: Wed, 17 May 2000 19:44:45 -0400 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/related; + boundary="----=_NextPart_000_000C_01BFC038.5A5C8E60" +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 + +This is a multi-part message in MIME format. + +------=_NextPart_000_000C_01BFC038.5A5C8E60 +Content-Type: multipart/alternative; + boundary="----=_NextPart_001_000D_01BFC038.5A5C8E60" + + +------=_NextPart_001_000D_01BFC038.5A5C8E60 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + +The Hare and the Tortoise=20 +=20 +A HARE one day ridiculed the short feet and slow pace of the Tortoise, = +who replied, laughing: "Though you be swift as the wind, I will beat = +you in a race." The Hare, believing her assertion to be simply = +impossible, assented to the proposal; and they agreed that the Fox = +should choose the course and fix the goal. On the day appointed for the = +race the two started together. The Tortoise never for a moment stopped, = +but went on with a slow but steady pace straight to the end of the = +course. The Hare, lying down by the wayside, fell fast asleep. At last = +waking up, and moving as fast as he could, he saw the Tortoise had = +reached the goal, and was comfortably dozing after her fatigue. =20 + + +=20 +Slow but steady wins the race. =20 + + + + +------=_NextPart_001_000D_01BFC038.5A5C8E60 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + +

The Hare and the Tortoise = +
 
A HARE=20 +one day ridiculed the short feet and slow pace of the Tortoise, who = +replied,=20 +laughing:  "Though you be swift as the wind, I will beat you in a=20 +race."  The Hare, believing her assertion to be simply impossible, = +assented=20 +to the proposal; and they agreed that the Fox should choose the course = +and fix=20 +the goal.  On the day appointed for the race the two started=20 +together.  The Tortoise never for a moment stopped, but went on = +with a slow=20 +but steady pace straight to the end of the course.  The Hare, lying = +down by=20 +the wayside, fell fast asleep.  At last waking up, and moving as = +fast as he=20 +could, he saw the Tortoise had reached the goal, and was comfortably = +dozing=20 +after her fatigue.  
+
 
+
3D"blue
 
Slow but = +steady wins=20 +the race. 
+
 
+
3D"red
+ +------=_NextPart_001_000D_01BFC038.5A5C8E60-- + +------=_NextPart_000_000C_01BFC038.5A5C8E60 +Content-Type: image/png; + name="blueball.png" +Content-Transfer-Encoding: base64 +Content-ID: <823504223@17052000-0f8d> + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA +CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ +MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO +5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1 +5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb +L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P +yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC +UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm +T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS +GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B +1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD +/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz +O7wAAAAASUVORK5CYII= + +------=_NextPart_000_000C_01BFC038.5A5C8E60 +Content-Type: image/png; + name="redball.png" +Content-Transfer-Encoding: base64 +Content-ID: <823504223@17052000-0f94> + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa +AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0 +AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM +AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm +f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB +AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2 +AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH +AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC +AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe +AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs +AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV +AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM +AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK +iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ +29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW +SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+ +d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q +m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV +tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw +HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5 +QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd +tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5 +IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== + +------=_NextPart_000_000C_01BFC038.5A5C8E60-- diff --git a/tests/resources/jmap_mail_get/multipart_cid.json b/tests/resources/jmap_mail_get/multipart_cid.json new file mode 100644 index 00000000..1bcfa5e4 --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_cid.json @@ -0,0 +1,271 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 7477, + "receivedAt": "2206-12-09T08:26:40Z", + "messageId": [ + "NDBBIAKOPKHFGPLCODIGKEKFCHAA.doug@example.com" + ], + "from": [ + { + "name": "Doug Sauder", + "email": "doug@example.com" + } + ], + "to": [ + { + "name": "Joe Blow", + "email": "jblow@example.com" + } + ], + "subject": "Test message from Microsoft Outlook 00", + "sentAt": "2000-05-17T23:44:45Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "From", + "value": " \"Doug Sauder\" " + }, + { + "name": "To", + "value": " \"Joe Blow\" " + }, + { + "name": "Subject", + "value": " Test message from Microsoft Outlook 00" + }, + { + "name": "Date", + "value": " Wed, 17 May 2000 19:44:45 -0400" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " multipart/related;\n\tboundary=\"----=_NextPart_000_000C_01BFC038.5A5C8E60\"" + }, + { + "name": "X-Priority", + "value": " 3 (Normal)" + }, + { + "name": "X-MSMail-Priority", + "value": " Normal" + }, + { + "name": "X-Mailer", + "value": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + { + "name": "Importance", + "value": " Normal" + }, + { + "name": "X-MimeOLE", + "value": " Produced By Microsoft MimeOLE V5.00.2314.1300" + } + ], + "type": "multipart/related", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/alternative;\n\tboundary=\"----=_NextPart_001_000D_01BFC038.5A5C8E60\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "partId": "2", + "blobId": "blob_0", + "size": 761, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain;\n\tcharset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/plain", + "charset": "iso-8859-1" + }, + { + "partId": "3", + "blobId": "blob_1", + "size": 1442, + "headers": [ + { + "name": "Content-Type", + "value": " text/html;\n\tcharset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/html", + "charset": "iso-8859-1" + } + ] + }, + { + "partId": "4", + "blobId": "blob_2", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"blueball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-ID", + "value": " <823504223@17052000-0f8d>" + } + ], + "name": "blueball.png", + "type": "image/png", + "cid": "823504223@17052000-0f8d" + }, + { + "partId": "5", + "blobId": "blob_3", + "size": 1453, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"redball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-ID", + "value": " <823504223@17052000-0f94>" + } + ], + "name": "redball.png", + "type": "image/png", + "cid": "823504223@17052000-0f94" + } + ] + }, + "bodyValues": { + "2": { + "value": "\nThe Hare and the Tortoise \n \nA HARE one day ridiculed the short feet and slow pace of the Tortoi...", + "isEncodingProblem": false, + "isTruncated": true + }, + "3": { + "value": "\n\n...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "2", + "blobId": "blob_0", + "size": 761, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain;\n\tcharset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/plain", + "charset": "iso-8859-1" + } + ], + "htmlBody": [ + { + "partId": "3", + "blobId": "blob_1", + "size": 1442, + "headers": [ + { + "name": "Content-Type", + "value": " text/html;\n\tcharset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/html", + "charset": "iso-8859-1" + } + ], + "attachments": [ + { + "partId": "4", + "blobId": "blob_2", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"blueball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-ID", + "value": " <823504223@17052000-0f8d>" + } + ], + "name": "blueball.png", + "type": "image/png", + "cid": "823504223@17052000-0f8d" + }, + { + "partId": "5", + "blobId": "blob_3", + "size": 1453, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"redball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-ID", + "value": " <823504223@17052000-0f94>" + } + ], + "name": "redball.png", + "type": "image/png", + "cid": "823504223@17052000-0f94" + } + ], + "hasAttachment": true, + "preview": "\nThe Hare and the Tortoise \n \nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who replied, laughing: \"Though you be swift as the wind, I will beat you in a race.\" The Hare, believing her assertion to be simply impossible, assent..." +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/multipart_mixed.eml b/tests/resources/jmap_mail_get/multipart_mixed.eml new file mode 100644 index 00000000..47851eb7 --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_mixed.eml @@ -0,0 +1,72 @@ +MIME-Version: 1.0 +From: Nathaniel Borenstein +To: Ned Freed +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 enriched. +as defined in RFC 1896 + +Isn't it +cool? + +--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-- diff --git a/tests/resources/jmap_mail_get/multipart_mixed.json b/tests/resources/jmap_mail_get/multipart_mixed.json new file mode 100644 index 00000000..559763bd --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_mixed.json @@ -0,0 +1,266 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 1853, + "receivedAt": "2028-09-19T18:13:20Z", + "from": [ + { + "name": "Nathaniel Borenstein", + "email": "nsb@nsb.fv.com" + } + ], + "to": [ + { + "name": "Ned Freed", + "email": "ned@innosoft.com" + } + ], + "subject": "A multipart example", + "sentAt": "1994-10-07T23:15:05Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "From", + "value": " Nathaniel Borenstein " + }, + { + "name": "To", + "value": " Ned Freed " + }, + { + "name": "Date", + "value": " Fri, 07 Oct 1994 16:15:05 -0700 (PDT)" + }, + { + "name": "Subject", + "value": " A multipart example" + }, + { + "name": "Content-Type", + "value": " multipart/mixed;\n boundary=unique-boundary-1" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 262, + "type": "text/plain", + "charset": "us-ascii" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 111, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=US-ASCII" + } + ], + "type": "text/plain", + "charset": "US-ASCII" + }, + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/parallel; boundary=unique-boundary-2" + } + ], + "type": "multipart/parallel", + "subParts": [ + { + "partId": "4", + "blobId": "blob_2", + "size": 85, + "headers": [ + { + "name": "Content-Type", + "value": " audio/basic" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "audio/basic", + "charset": "us-ascii" + }, + { + "partId": "5", + "blobId": "blob_3", + "size": 44, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg", + "charset": "us-ascii" + } + ] + }, + { + "partId": "6", + "blobId": "blob_4", + "size": 140, + "headers": [ + { + "name": "Content-Type", + "value": " text/enriched" + } + ], + "type": "text/enriched", + "charset": "us-ascii" + }, + { + "partId": "7", + "blobId": "blob_5", + "size": 223, + "headers": [ + { + "name": "Content-Type", + "value": " message/rfc822" + } + ], + "type": "message/rfc822" + } + ] + }, + "bodyValues": { + "1": { + "value": "... Some text appears here ...\n\n[Note that the blank between the boundary and the start\nof the te...", + "isEncodingProblem": false, + "isTruncated": true + }, + "2": { + "value": "This could have been part of the previous part, but\nillustrates explicit versus implicit typing o...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 262, + "type": "text/plain", + "charset": "us-ascii" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 111, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=US-ASCII" + } + ], + "type": "text/plain", + "charset": "US-ASCII" + } + ], + "htmlBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 262, + "type": "text/plain", + "charset": "us-ascii" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 111, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=US-ASCII" + } + ], + "type": "text/plain", + "charset": "US-ASCII" + } + ], + "attachments": [ + { + "partId": "4", + "blobId": "blob_2", + "size": 85, + "headers": [ + { + "name": "Content-Type", + "value": " audio/basic" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "audio/basic", + "charset": "us-ascii" + }, + { + "partId": "5", + "blobId": "blob_3", + "size": 44, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg", + "charset": "us-ascii" + }, + { + "partId": "6", + "blobId": "blob_4", + "size": 140, + "headers": [ + { + "name": "Content-Type", + "value": " text/enriched" + } + ], + "type": "text/enriched", + "charset": "us-ascii" + }, + { + "partId": "7", + "blobId": "blob_5", + "size": 223, + "headers": [ + { + "name": "Content-Type", + "value": " message/rfc822" + } + ], + "type": "message/rfc822" + } + ], + "hasAttachment": true, + "preview": "... 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\nnex..." +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/multipart_related.eml b/tests/resources/jmap_mail_get/multipart_related.eml new file mode 100644 index 00000000..f2df6218 --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_related.eml @@ -0,0 +1,198 @@ +Message-Id: <4.2.0.58.20000519003556.00a918e0@pop.example.com> +X-Sender: dwsauder@pop.example.com (Unverified) +X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 +X-Priority: 2 (High) +Date: Fri, 19 May 2000 00:36:58 -0400 +To: Heinz =?iso-8859-1?Q?Muller?= +From: Doug Sauder +Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Frosche?= +Mime-Version: 1.0 +Content-Type: multipart/mixed; + boundary="=====================_715392540==_" + +--=====================_715392540==_ +Content-Type: multipart/related; + type="multipart/alternative"; + boundary="=====================_715392540==_.REL" + +--=====================_715392540==_.REL +Content-Type: multipart/alternative; + boundary="=====================_715392550==_.ALT" + +--=====================_715392550==_.ALT +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +Die Hasen und die Fr=F6sche + +Die Hasen klagten einst =FCber ihre mi=DFliche Lage; "wir leben", sprach ein= + Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,= + der Adler, ja fast aller Raubtiere! Unsere stete Angst ist =E4rger als der= + Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20 + +In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= + allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt= + erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie= + aufs schnellste untertauchten.=20 + +"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch ein= + wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere,= + welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 + +2aa3ed95.png2aa3edd1.png +--=====================_715392550==_.ALT +Content-Type: text/html; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + +Die Hasen und = +die +Fr=F6sche
+
+
Die Hasen klagten einst =FCber +ihre mi=DFliche Lage; "wir leben", sprach ein Redner, "in +steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, +ja fast aller Raubtiere! Unsere stete Angst ist =E4rger als der Tod selbst. +Auf, la=DFt uns ein f=FCr allemal sterben."
+
+In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; +allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt +erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie au= +fs +schnellste untertauchten.
+
+"Halt", rief nun eben dieser Sprecher, "wir wollen das +Ers=E4ufen noch ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr +seht, einige Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als +wir."
+
+
3D"2aa3ed95.png" + +--=====================_715392550==_.ALT-- + +--=====================_715392540==_.REL +Content-Type: image/png; name="2aa3ed95.png" +Content-ID: <4.2.0.58.20000519003556.00a918e0@pop.example.com.2> +Content-Transfer-Encoding: base64 +Content-Disposition: inline; filename="2aa3ed95.png" + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA +CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ +MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO +5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1 +5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb +L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P +yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC +UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm +T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS +GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B +1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD +/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz +O7wAAAAASUVORK5CYII= +--=====================_715392540==_.REL +Content-Type: image/png; name="2aa3edd1.png" +Content-ID: <4.2.0.58.20000519003556.00a918e0@pop.example.com.3> +Content-Transfer-Encoding: base64 +Content-Disposition: inline; filename="2aa3edd1.png" + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa +AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0 +AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM +AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm +f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB +AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2 +AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH +AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC +AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe +AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs +AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV +AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM +AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK +iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ +29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW +SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+ +d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q +m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV +tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw +HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5 +QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd +tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5 +IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== +--=====================_715392540==_.REL-- + +--=====================_715392540==_ +Content-Type: image/png; name="blueball.png" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename="blueball.png" + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA +CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ +MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO +5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1 +5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb +L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P +yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC +UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm +T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS +GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B +1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD +/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz +O7wAAAAASUVORK5CYII= +--=====================_715392540==_ +Content-Type: image/png; name="greenball.png" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; filename="greenball.png" + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAAAEAAAGAAAIQAA +CAAAMQAAQgAAUgAAWgAASgAIYwAIcwAIewAQjAAIawAAOQAAYwAQlAAQnAAhpQAQpQAhrQBCvRhj +xjFjxjlSxiEpzgAYvQAQrQAYrQAhvQCU1mOt1nuE1lJK3hgh1gAYxgAYtQAAKQBCzhDO55Te563G +55SU52NS5yEh3gAYzgBS3iGc52vW75y974yE71JC7xCt73ul3nNa7ykh5wAY1gAx5wBS7yFr7zlK +7xgp5wAp7wAx7wAIhAAQtQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAp1fnZAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAFtSURBVHicddJtV8IgFAdwD2zIgMEE1+NcqdsoK+m5tCyz7/+ZiLmHsyzvq53zO/cy ++N9ery1bVe9PWQA9z4MQ+H8Yoj7GASZ95IHfaBGmLOSchyIgyOu22mgQSjUcDuNYcoGjLiLK1cHh +0fHJaTKKOcMItgYxT89OzsfjyTTLC8UF0c2ZNmKquJhczq6ub+YmSVUYRF59GeDastu7+9nD41Nm +kiJ2jc2J3kAWZ9Pr55fH18XSmRuKUTXUaqHy7O19tfr4NFle/w3YDrWRUIlZrL/W86XJkyJVG9Ea +EjIx2XyZmZJGioeUaL+2AY8TY8omR6nkLKhu70zjUKVJXsp3quS2DVSJWNh3zzJKCyexI0ZxBP3a +fE0ElyqOlZJyw8r3BE2SFiJCyxA434SCkg65RhdeQBljQtCg39LWrA90RDDG1EWrYUO23hMANUKR +Rl61E529cR++D2G5LK002dr/qrcfu9u0V3bxn/XdhR/NYeeN0ggsLAAAACV0RVh0Q29tbWVudABj +bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= +--=====================_715392540==_-- + diff --git a/tests/resources/jmap_mail_get/multipart_related.json b/tests/resources/jmap_mail_get/multipart_related.json new file mode 100644 index 00000000..2d8168ae --- /dev/null +++ b/tests/resources/jmap_mail_get/multipart_related.json @@ -0,0 +1,383 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 11304, + "receivedAt": "2328-03-18T08:00:00Z", + "messageId": [ + "4.2.0.58.20000519003556.00a918e0@pop.example.com" + ], + "from": [ + { + "name": "Doug Sauder", + "email": "dwsauder@example.com" + } + ], + "to": [ + { + "name": "Heinz Muller", + "email": "mueller@example.com" + } + ], + "subject": "Die Hasen und die Frosche", + "sentAt": "2000-05-19T04:36:58Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Message-ID", + "value": " <4.2.0.58.20000519003556.00a918e0@pop.example.com>" + }, + { + "name": "X-Sender", + "value": " dwsauder@pop.example.com (Unverified)" + }, + { + "name": "X-Mailer", + "value": " QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + { + "name": "X-Priority", + "value": " 2 (High)" + }, + { + "name": "Date", + "value": " Fri, 19 May 2000 00:36:58 -0400" + }, + { + "name": "To", + "value": " Heinz =?iso-8859-1?Q?Muller?= " + }, + { + "name": "From", + "value": " Doug Sauder " + }, + { + "name": "Subject", + "value": " =?iso-8859-1?Q?Die_Hasen_und_die_Frosche?=" + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " multipart/mixed;\n\tboundary=\"=====================_715392540==_\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/related;\n\ttype=\"multipart/alternative\";\n\tboundary=\"=====================_715392540==_.REL\"" + } + ], + "type": "multipart/related", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/alternative;\n\tboundary=\"=====================_715392550==_.ALT\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "partId": "3", + "blobId": "blob_0", + "size": 779, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/plain", + "charset": "iso-8859-1" + }, + { + "partId": "4", + "blobId": "blob_1", + "size": 1154, + "headers": [ + { + "name": "Content-Type", + "value": " text/html; charset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/html", + "charset": "iso-8859-1" + } + ] + }, + { + "partId": "5", + "blobId": "blob_2", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"2aa3ed95.png\"" + }, + { + "name": "Content-ID", + "value": " <4.2.0.58.20000519003556.00a918e0@pop.example.com.2>" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; filename=\"2aa3ed95.png\"" + } + ], + "name": "2aa3ed95.png", + "type": "image/png", + "disposition": "inline", + "cid": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" + }, + { + "partId": "6", + "blobId": "blob_3", + "size": 1453, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"2aa3edd1.png\"" + }, + { + "name": "Content-ID", + "value": " <4.2.0.58.20000519003556.00a918e0@pop.example.com.3>" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; filename=\"2aa3edd1.png\"" + } + ], + "name": "2aa3edd1.png", + "type": "image/png", + "disposition": "inline", + "cid": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" + } + ] + }, + { + "partId": "7", + "blobId": "blob_4", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"blueball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment; filename=\"blueball.png\"" + } + ], + "name": "blueball.png", + "type": "image/png", + "disposition": "attachment" + }, + { + "partId": "8", + "blobId": "blob_5", + "size": 1298, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"greenball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment; filename=\"greenball.png\"" + } + ], + "name": "greenball.png", + "type": "image/png", + "disposition": "attachment" + } + ] + }, + "bodyValues": { + "3": { + "value": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprac...", + "isEncodingProblem": false, + "isTruncated": true + }, + "4": { + "value": "\nDie Hasen und die\nFrösche
\n...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "3", + "blobId": "blob_0", + "size": 779, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/plain", + "charset": "iso-8859-1" + } + ], + "htmlBody": [ + { + "partId": "4", + "blobId": "blob_1", + "size": 1154, + "headers": [ + { + "name": "Content-Type", + "value": " text/html; charset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/html", + "charset": "iso-8859-1" + } + ], + "attachments": [ + { + "partId": "5", + "blobId": "blob_2", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"2aa3ed95.png\"" + }, + { + "name": "Content-ID", + "value": " <4.2.0.58.20000519003556.00a918e0@pop.example.com.2>" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; filename=\"2aa3ed95.png\"" + } + ], + "name": "2aa3ed95.png", + "type": "image/png", + "disposition": "inline", + "cid": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" + }, + { + "partId": "6", + "blobId": "blob_3", + "size": 1453, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"2aa3edd1.png\"" + }, + { + "name": "Content-ID", + "value": " <4.2.0.58.20000519003556.00a918e0@pop.example.com.3>" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; filename=\"2aa3edd1.png\"" + } + ], + "name": "2aa3edd1.png", + "type": "image/png", + "disposition": "inline", + "cid": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" + }, + { + "partId": "7", + "blobId": "blob_4", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"blueball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment; filename=\"blueball.png\"" + } + ], + "name": "blueball.png", + "type": "image/png", + "disposition": "attachment" + }, + { + "partId": "8", + "blobId": "blob_5", + "size": 1298, + "headers": [ + { + "name": "Content-Type", + "value": " image/png; name=\"greenball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment; filename=\"greenball.png\"" + } + ], + "name": "greenball.png", + "type": "image/png", + "disposition": "attachment" + } + ], + "hasAttachment": true, + "preview": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod..." +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/rfc8621.eml b/tests/resources/jmap_mail_get/rfc8621.eml new file mode 100644 index 00000000..df5a9efd --- /dev/null +++ b/tests/resources/jmap_mail_get/rfc8621.eml @@ -0,0 +1,72 @@ +Subject: RFC 8621 Section 4.1.4 test +Content-Type: multipart/mixed; boundary="1" + +--1 +Content-Type: text/plain +Content-Disposition: inline + +A +--1 +Content-Type: multipart/mixed; boundary="2" + +--2 +Content-Type: multipart/alternative; boundary="3" + +--3 +Content-Type: multipart/mixed; boundary="4" + +--4 +Content-Type: text/plain +Content-Disposition: inline + +B +--4 +Content-Type: image/jpeg +Content-Disposition: inline + +C +--4 +Content-Type: text/plain +Content-Disposition: inline + +D +--4-- + +--3 +Content-Type: multipart/related; boundary="5" + +--5 +Content-Type: text/html + +E +--5 +Content-Type: image/jpeg + +F +--5-- + +--3-- + +--2 +Content-Type: image/jpeg +Content-Disposition: attachment + +G +--2 +Content-Type: application/x-excel + +H +--2 +Content-Type: message/rfc822 + +Subject: J + +J +--2-- + +--1 +Content-Type: text/plain +Content-Disposition: inline + +K +--1-- diff --git a/tests/resources/jmap_mail_get/rfc8621.json b/tests/resources/jmap_mail_get/rfc8621.json new file mode 100644 index 00000000..549984ed --- /dev/null +++ b/tests/resources/jmap_mail_get/rfc8621.json @@ -0,0 +1,478 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 870, + "receivedAt": "1997-07-27T10:40:00Z", + "subject": "RFC 8621 Section 4.1.4 test", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Subject", + "value": " RFC 8621 Section 4.1.4 test" + }, + { + "name": "Content-Type", + "value": " multipart/mixed; boundary=\"1\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/mixed; boundary=\"2\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/alternative; boundary=\"3\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/mixed; boundary=\"4\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "5", + "blobId": "blob_1", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "6", + "blobId": "blob_2", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "image/jpeg", + "disposition": "inline" + }, + { + "partId": "7", + "blobId": "blob_3", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ] + }, + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/related; boundary=\"5\"" + } + ], + "type": "multipart/related", + "subParts": [ + { + "partId": "9", + "blobId": "blob_4", + "size": 14, + "headers": [ + { + "name": "Content-Type", + "value": " text/html" + } + ], + "type": "text/html", + "charset": "us-ascii" + }, + { + "partId": "10", + "blobId": "blob_5", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + } + ], + "type": "image/jpeg" + } + ] + } + ] + }, + { + "partId": "11", + "blobId": "blob_6", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Disposition", + "value": " attachment" + } + ], + "type": "image/jpeg", + "disposition": "attachment" + }, + { + "partId": "12", + "blobId": "blob_7", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " application/x-excel" + } + ], + "type": "application/x-excel" + }, + { + "partId": "13", + "blobId": "blob_8", + "size": 13, + "headers": [ + { + "name": "Content-Type", + "value": " message/rfc822" + } + ], + "type": "message/rfc822" + } + ] + }, + { + "partId": "14", + "blobId": "blob_9", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ] + }, + "bodyValues": { + "1": { + "value": "A", + "isEncodingProblem": false, + "isTruncated": false + }, + "14": { + "value": "K", + "isEncodingProblem": false, + "isTruncated": false + }, + "5": { + "value": "B", + "isEncodingProblem": false, + "isTruncated": false + }, + "6": { + "value": "C", + "isEncodingProblem": false, + "isTruncated": false + }, + "7": { + "value": "D", + "isEncodingProblem": false, + "isTruncated": false + }, + "9": { + "value": "E", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "5", + "blobId": "blob_1", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "6", + "blobId": "blob_2", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "image/jpeg", + "disposition": "inline" + }, + { + "partId": "7", + "blobId": "blob_3", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "14", + "blobId": "blob_9", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ], + "htmlBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "9", + "blobId": "blob_4", + "size": 14, + "headers": [ + { + "name": "Content-Type", + "value": " text/html" + } + ], + "type": "text/html", + "charset": "us-ascii" + }, + { + "partId": "14", + "blobId": "blob_9", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ], + "attachments": [ + { + "partId": "6", + "blobId": "blob_2", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Disposition", + "value": " inline" + } + ], + "type": "image/jpeg", + "disposition": "inline" + }, + { + "partId": "10", + "blobId": "blob_5", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + } + ], + "type": "image/jpeg" + }, + { + "partId": "11", + "blobId": "blob_6", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Disposition", + "value": " attachment" + } + ], + "type": "image/jpeg", + "disposition": "attachment" + }, + { + "partId": "12", + "blobId": "blob_7", + "size": 1, + "headers": [ + { + "name": "Content-Type", + "value": " application/x-excel" + } + ], + "type": "application/x-excel" + }, + { + "partId": "13", + "blobId": "blob_8", + "size": 13, + "headers": [ + { + "name": "Content-Type", + "value": " message/rfc822" + } + ], + "type": "message/rfc822" + } + ], + "hasAttachment": true, + "preview": "A" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/single_part.eml b/tests/resources/jmap_mail_get/single_part.eml new file mode 100644 index 00000000..6e976bbd --- /dev/null +++ b/tests/resources/jmap_mail_get/single_part.eml @@ -0,0 +1,30 @@ +From: "Doug Sauder" +To: =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= +Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?= +Date: Wed, 17 May 2000 19:15:35 -0400 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 + +Die Hasen und die Fr=F6sche + +Die Hasen klagten einst =FCber ihre mi=DFliche Lage; "wir leben", sprach = +ein Redner, "in steter Furcht vor Menschen und Tieren, eine Beute der = +Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist = +=E4rger als der Tod selbst. Auf, la=DFt uns ein f=FCr allemal sterben."=20 + +In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; = +allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt = +erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF = +sie aufs schnellste untertauchten.=20 + +"Halt", rief nun eben dieser Sprecher, "wir wollen das Ers=E4ufen noch = +ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige = +Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 diff --git a/tests/resources/jmap_mail_get/single_part.json b/tests/resources/jmap_mail_get/single_part.json new file mode 100644 index 00000000..8ceff7b6 --- /dev/null +++ b/tests/resources/jmap_mail_get/single_part.json @@ -0,0 +1,224 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 1378, + "receivedAt": "2013-09-01T01:46:40Z", + "messageId": [ + "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com" + ], + "from": [ + { + "name": "Doug Sauder", + "email": "doug@example.com" + } + ], + "to": [ + { + "name": "Jürgen Schmürgen", + "email": "schmuergen@example.com" + } + ], + "subject": "Die Hasen und die Frösche (Microsoft Outlook 00)", + "sentAt": "2000-05-17T23:15:35Z", + "bodyStructure": { + "partId": "0", + "blobId": "blob_0", + "size": 754, + "headers": [ + { + "name": "From", + "value": " \"Doug Sauder\" " + }, + { + "name": "To", + "value": " =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= " + }, + { + "name": "Subject", + "value": " =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=" + }, + { + "name": "Date", + "value": " Wed, 17 May 2000 19:15:35 -0400" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " text/plain;\n\tcharset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + }, + { + "name": "X-Priority", + "value": " 3 (Normal)" + }, + { + "name": "X-MSMail-Priority", + "value": " Normal" + }, + { + "name": "X-Mailer", + "value": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + { + "name": "Importance", + "value": " Normal" + }, + { + "name": "X-MimeOLE", + "value": " Produced By Microsoft MimeOLE V5.00.2314.1300" + } + ], + "type": "text/plain", + "charset": "iso-8859-1" + }, + "bodyValues": { + "0": { + "value": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprac...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "0", + "blobId": "blob_0", + "size": 754, + "headers": [ + { + "name": "From", + "value": " \"Doug Sauder\" " + }, + { + "name": "To", + "value": " =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= " + }, + { + "name": "Subject", + "value": " =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=" + }, + { + "name": "Date", + "value": " Wed, 17 May 2000 19:15:35 -0400" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " text/plain;\n\tcharset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + }, + { + "name": "X-Priority", + "value": " 3 (Normal)" + }, + { + "name": "X-MSMail-Priority", + "value": " Normal" + }, + { + "name": "X-Mailer", + "value": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + { + "name": "Importance", + "value": " Normal" + }, + { + "name": "X-MimeOLE", + "value": " Produced By Microsoft MimeOLE V5.00.2314.1300" + } + ], + "type": "text/plain", + "charset": "iso-8859-1" + } + ], + "htmlBody": [ + { + "partId": "0", + "blobId": "blob_0", + "size": 754, + "headers": [ + { + "name": "From", + "value": " \"Doug Sauder\" " + }, + { + "name": "To", + "value": " =?iso-8859-1?B?SvxyZ2VuIFNjaG38cmdlbg==?= " + }, + { + "name": "Subject", + "value": " =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche_=28Microsoft_Outlook_00=29?=" + }, + { + "name": "Date", + "value": " Wed, 17 May 2000 19:15:35 -0400" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " text/plain;\n\tcharset=\"iso-8859-1\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + }, + { + "name": "X-Priority", + "value": " 3 (Normal)" + }, + { + "name": "X-MSMail-Priority", + "value": " Normal" + }, + { + "name": "X-Mailer", + "value": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + { + "name": "Importance", + "value": " Normal" + }, + { + "name": "X-MimeOLE", + "value": " Produced By Microsoft MimeOLE V5.00.2314.1300" + } + ], + "type": "text/plain", + "charset": "iso-8859-1" + } + ], + "attachments": [], + "hasAttachment": false, + "preview": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod..." +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/text_body_missing.eml b/tests/resources/jmap_mail_get/text_body_missing.eml new file mode 100644 index 00000000..5aea5ace --- /dev/null +++ b/tests/resources/jmap_mail_get/text_body_missing.eml @@ -0,0 +1,43 @@ +From: "Doug Sauder" +To: "Joe Blow" +Subject: Test message from Microsoft Outlook 00 +Date: Wed, 17 May 2000 19:35:05 -0400 +Message-ID: +MIME-Version: 1.0 +Content-Type: image/png; + name="redball.png" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; + filename="redball.png" +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa +AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0 +AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM +AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm +f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB +AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2 +AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH +AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC +AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe +AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs +AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV +AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM +AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK +iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ +29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW +SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+ +d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q +m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV +tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw +HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5 +QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd +tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5 +IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== diff --git a/tests/resources/jmap_mail_get/text_body_missing.json b/tests/resources/jmap_mail_get/text_body_missing.json new file mode 100644 index 00000000..91cb24e9 --- /dev/null +++ b/tests/resources/jmap_mail_get/text_body_missing.json @@ -0,0 +1,165 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 2527, + "receivedAt": "2050-01-28T16:26:40Z", + "messageId": [ + "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" + ], + "from": [ + { + "name": "Doug Sauder", + "email": "doug@example.com" + } + ], + "to": [ + { + "name": "Joe Blow", + "email": "jblow@example.com" + } + ], + "subject": "Test message from Microsoft Outlook 00", + "sentAt": "2000-05-17T23:35:05Z", + "bodyStructure": { + "partId": "0", + "blobId": "blob_0", + "size": 1453, + "headers": [ + { + "name": "From", + "value": " \"Doug Sauder\" " + }, + { + "name": "To", + "value": " \"Joe Blow\" " + }, + { + "name": "Subject", + "value": " Test message from Microsoft Outlook 00" + }, + { + "name": "Date", + "value": " Wed, 17 May 2000 19:35:05 -0400" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"redball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment;\n\tfilename=\"redball.png\"" + }, + { + "name": "X-Priority", + "value": " 3 (Normal)" + }, + { + "name": "X-MSMail-Priority", + "value": " Normal" + }, + { + "name": "X-Mailer", + "value": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + { + "name": "Importance", + "value": " Normal" + }, + { + "name": "X-MimeOLE", + "value": " Produced By Microsoft MimeOLE V5.00.2314.1300" + } + ], + "name": "redball.png", + "type": "image/png", + "disposition": "attachment" + }, + "bodyValues": {}, + "textBody": [], + "htmlBody": [], + "attachments": [ + { + "partId": "0", + "blobId": "blob_0", + "size": 1453, + "headers": [ + { + "name": "From", + "value": " \"Doug Sauder\" " + }, + { + "name": "To", + "value": " \"Joe Blow\" " + }, + { + "name": "Subject", + "value": " Test message from Microsoft Outlook 00" + }, + { + "name": "Date", + "value": " Wed, 17 May 2000 19:35:05 -0400" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"redball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment;\n\tfilename=\"redball.png\"" + }, + { + "name": "X-Priority", + "value": " 3 (Normal)" + }, + { + "name": "X-MSMail-Priority", + "value": " Normal" + }, + { + "name": "X-Mailer", + "value": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + { + "name": "Importance", + "value": " Normal" + }, + { + "name": "X-MimeOLE", + "value": " Produced By Microsoft MimeOLE V5.00.2314.1300" + } + ], + "name": "redball.png", + "type": "image/png", + "disposition": "attachment" + } + ], + "hasAttachment": true +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_get/text_body_missing_multipart.eml b/tests/resources/jmap_mail_get/text_body_missing_multipart.eml new file mode 100644 index 00000000..bf9b5b67 --- /dev/null +++ b/tests/resources/jmap_mail_get/text_body_missing_multipart.eml @@ -0,0 +1,83 @@ +From: "Doug Sauder" +To: "Joe Blow" +Subject: Test message from Microsoft Outlook 00 +Date: Wed, 17 May 2000 19:36:13 -0400 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="----=_NextPart_000_0004_01BFC037.28F2FA90" +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0004_01BFC037.28F2FA90 +Content-Type: image/png; + name="blueball.png" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; + filename="blueball.png" + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAgAABAAABgAAAAA +CCkAEEIAEEoACDEAEFIIIXMIKXsIKYQIIWsAGFoACDkIIWMQOZwYQqUYQq0YQrUQOaUQMZQAGFIQ +MYwpUrU5Y8Y5Y84pWs4YSs4YQs4YQr1Ca8Z7nNacvd6Mtd5jlOcxa94hUt4YStYYQsYQMaUAACHO +5+/n7++cxu9ShO8pWucQOa1Ke86tzt6lzu9ajO8QMZxahNat1ufO7++Mve9Ke+8YOaUYSsaMvee1 +5++Uve8AAClajOdzpe9rnO8IKYwxY+8pWu8IIXsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAADBMg1VAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAGISURBVHicddJtV5swGAbgEk6AJhBSk4bMCUynBSLaqovbrG/bfPn/vyh70lbssceb +L5xznTsh5BmNhgQoRChwo50EOIohUYLDj4zHhKYQkrEoQdvock4ne0IKMVUpKZLQDeqSTIsv+18P +yqqWUw2IBsRM7307PPp+fDJrWtnpLDJvewYxnewfnvanZ+fzpmwXijC8KbqEa3Fx2ff91Y95U9XC +UpaDeQwiMpHXP/v+1++bWVPWQoGFawtjury9vru/f/C1Vi7ezT0WWpQHf/7+u/G71aLThK/MjRxm +T6KdzZ9fGk9yatMsTgZLl3XVgFRAC6spj/13enssqJVtWVa3NdBSacL8+VZmYqKmdd1CSYoOiMOS +GwtzlqqlFFIuOqv0a1ZEZrUkWICLLFW266y1KvWE1zV/iDAH1EopnVLCiygZCIomH3NCKX0lnI+B +1iuuzCGTxwXjnDO4d7NpbX42YJJHkBwmAm2TxwAZg40J3+Xtbv1rgOAZwG0NxW62p+lT+Yi747sD +/wEUVMzYmWkOvwAAACV0RVh0Q29tbWVudABjbGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZz +O7wAAAAASUVORK5CYII= + +------=_NextPart_000_0004_01BFC037.28F2FA90 +Content-Type: image/png; + name="redball.png" +Content-Transfer-Encoding: base64 +Content-Disposition: attachment; + filename="redball.png" + +iVBORw0KGgoAAAANSUhEUgAAABsAAAAbCAMAAAC6CgRnAAADAFBMVEX///8AAAABAAALAAAVAAAa +AAAXAAARAAAKAAADAAAcAAAyAABEAABNAABIAAA9AAAjAAAWAAAmAABhAAB7AACGAACHAAB9AAB0 +AABgAAA5AAAUAAAGAAAnAABLAABvAACQAAClAAC7AAC/AACrAAChAACMAABzAABbAAAuAAAIAABM +AAB3AACZAAC0GRnKODjVPT3bKSndBQW4AACoAAB5AAAxAAAYAAAEAABFAACaAAC7JCTRYWHfhITm +f3/mVlbqHx/SAAC5AACjAABdAABCAAAoAAAJAABnAAC6Dw/QVFTek5PlrKzpmZntZWXvJSXXAADB +AACxAACcAABtAABTAAA2AAAbAAAFAABKAACBAADLICDdZ2fonJzrpqbtiorvUVHvFBTRAADDAAC2 +AAB4AABeAABAAAAiAABXAACSAADCAADaGxvoVVXseHjveHjvV1fvJibhAADOAAC3AACnAACVAABH +AAArAAAPAACdAADFAADhBQXrKCjvPDzvNTXvGxvjAADQAADJAAC1AACXAACEAABsAABPAAASAAAC +AABiAADpAADvAgLnAADYAADLAAC6AACwAABwAAATAAAkAABYAADIAADTAADNAACzAACDAABuAAAe +AAB+AADAAACkAACNAAB/AABpAABQAAAwAACRAACpAAC8AACqAACbAABlAABJAAAqAAAOAAA0AACs +AACvAACtAACmAACJAAB6AABrAABaAAA+AAApAABqAACCAACfAACeAACWAACPAAB8AAAZAAAHAABV +AACOAACKAAA4AAAQAAA/AAByAACAAABcAAA3AAAsAABmAABDAABWAAAgAAAzAAA8AAA6AAAfAAAM +AAAdAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAD8LtlFAAAAAXRSTlMAQObYZgAAABZ0RVh0U29mdHdhcmUAZ2lmMnBuZyAyLjAu +MT1evmgAAAIISURBVHicY2CAg/8QwIABmJhZWFnZ2Dk4MaU5uLh5eHn5+LkFBDlQJf8zC/EIi4iK +iUtI8koJScsgyf5nlpWTV1BUUlZRVVPX4NFk1UJIyghp6+jq6RsYGhmbKJgK85mZW8Dk/rNaSlhZ +29ja2Ts4Ojkr6Li4urFDNf53N/Ow8vTy9vH18w8IDAoWDQkNC4+ASP5ni4wKio6JjYtPSExKTnFW +SE1LF4A69n9GZlZ2Tm5efkFhUXFySWlZlEd5RSVY7j+TkGRVdU1tXX1DY1Ozcktpa1t7h2YnOAj+ +d7l1tyo79vT29SdNSJ44SbFVdHIo9xSIHNPUaWqTpifNSJrZnK00S0U1a/acUG5piNz/uXLzVJ2q +m6dXz584S2WB1cJFi5cshZr539xVftnyFKUVTi2TVjqvyhJLXb1m7TqoHPt6F/HW0g0bN63crGqV +tWXrtu07BJihcsw71+zanRW8Z89eq337RQ/Ip60xO3gIElX/LbikDm8T36KwbNmRo7O3zpHkPSZw +HBqL//8flz1x2OOkyKJTi7aqbzutfUZI2gIuF8F2lr/D5dw2+fZdwpl8YVOlI+CJ4/9/joOyYed5 +QzMvhGqnm2V0WiClm///D0lfXHtJ6vLlK9w7rx7vQk5SQJbFtSms1y9evXid7QZacgOxmSxktNzd +tSwwU+J/VICaCPFIYU3XAJhIOtjf5sfyAAAAJXRFWHRDb21tZW50AGNsaXAyZ2lmIHYuMC42IGJ5 +IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== + +------=_NextPart_000_0004_01BFC037.28F2FA90-- diff --git a/tests/resources/jmap_mail_get/text_body_missing_multipart.json b/tests/resources/jmap_mail_get/text_body_missing_multipart.json new file mode 100644 index 00000000..081a02a2 --- /dev/null +++ b/tests/resources/jmap_mail_get/text_body_missing_multipart.json @@ -0,0 +1,177 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "tag": true + }, + "size": 4726, + "receivedAt": "2119-10-06T01:46:40Z", + "messageId": [ + "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" + ], + "from": [ + { + "name": "Doug Sauder", + "email": "doug@example.com" + } + ], + "to": [ + { + "name": "Joe Blow", + "email": "jblow@example.com" + } + ], + "subject": "Test message from Microsoft Outlook 00", + "sentAt": "2000-05-17T23:36:13Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "From", + "value": " \"Doug Sauder\" " + }, + { + "name": "To", + "value": " \"Joe Blow\" " + }, + { + "name": "Subject", + "value": " Test message from Microsoft Outlook 00" + }, + { + "name": "Date", + "value": " Wed, 17 May 2000 19:36:13 -0400" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "MIME-Version", + "value": " 1.0" + }, + { + "name": "Content-Type", + "value": " multipart/mixed;\n\tboundary=\"----=_NextPart_000_0004_01BFC037.28F2FA90\"" + }, + { + "name": "X-Priority", + "value": " 3 (Normal)" + }, + { + "name": "X-MSMail-Priority", + "value": " Normal" + }, + { + "name": "X-Mailer", + "value": " Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + { + "name": "Importance", + "value": " Normal" + }, + { + "name": "X-MimeOLE", + "value": " Produced By Microsoft MimeOLE V5.00.2314.1300" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"blueball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment;\n\tfilename=\"blueball.png\"" + } + ], + "name": "blueball.png", + "type": "image/png", + "disposition": "attachment" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 1453, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"redball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment;\n\tfilename=\"redball.png\"" + } + ], + "name": "redball.png", + "type": "image/png", + "disposition": "attachment" + } + ] + }, + "bodyValues": {}, + "textBody": [], + "htmlBody": [], + "attachments": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 1325, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"blueball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment;\n\tfilename=\"blueball.png\"" + } + ], + "name": "blueball.png", + "type": "image/png", + "disposition": "attachment" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 1453, + "headers": [ + { + "name": "Content-Type", + "value": " image/png;\n\tname=\"redball.png\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " attachment;\n\tfilename=\"redball.png\"" + } + ], + "name": "redball.png", + "type": "image/png", + "disposition": "attachment" + } + ], + "hasAttachment": true +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_parse/attachment.eml b/tests/resources/jmap_mail_parse/attachment.eml new file mode 100644 index 00000000..042e0623 --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment.eml @@ -0,0 +1,72 @@ +From: Al Gore +To: White House Transportation Coordinator + +Subject: [Fwd: Map of Argentina with Description] +Content-Type: multipart/mixed; + boundary="D7F------------D7FD5A0B8AB9C65CCDBFA872" + +This is a multi-part message in MIME format. +--D7F------------D7FD5A0B8AB9C65CCDBFA872 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit + +Fred, + +Fire up Air Force One! We're going South! + +Thanks, +Al +--D7F------------D7FD5A0B8AB9C65CCDBFA872 +Content-Type: message/rfc822 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Return-Path: +Received: from mailhost.whitehouse.gov ([192.168.51.200]) + by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453 + for ; + Mon, 13 Aug 1998 l8:14:23 +1000 +Received: from the_big_box.whitehouse.gov ([192.168.51.50]) + by mailhost.whitehouse.gov (8.8.8/8.8.7) with ESMTP id RAA20366 + for vice-president@whitehouse.gov; Mon, 13 Aug 1998 17:42:41 +1000 +Date: Mon, 13 Aug 1998 17:42:41 +1000 +Message-Id: <199804130742.RAA20366@mai1host.whitehouse.gov> +From: Bill Clinton +To: A1 (The Enforcer) Gore +Subject: Map of Argentina with Description +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="DC8------------DC8638F443D87A7F0726DEF7" + +This is a multi-part message in MIME format. +--DC8------------DC8638F443D87A7F0726DEF7 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit + +Hi A1, + +I finally figured out this MIME thing. Pretty cool. I'll send you +some sax music in .au files next week! + +Anyway, the attached image is really too small to get a good look at +Argentina. Try this for a much better map: + + http://www.1one1yp1anet.com/dest/sam/graphics/map-arg.htm + +Then again, shouldn't the CIA have something like that? + +Bill +--DC8------------DC8638F443D87A7F0726DEF7 +Content-Type: image/gif; name="map_of_Argentina.gif" +Content-Transfer-Encoding: base64 +Content-Disposition: inline; fi1ename="map_of_Argentina.gif" + +R01GOD1hJQA1AKIAAP/////78P/omn19fQAAAAAAAAAAAAAAACwAAAAAJQA1AAAD7Qi63P5w +wEmjBCLrnQnhYCgM1wh+pkgqqeC9XrutmBm7hAK3tP31gFcAiFKVQrGFR6kscnonTe7FAAad +GugmRu3CmiBt57fsVq3Y0VFKnpYdxPC6M7Ze4crnnHum4oN6LFJ1bn5NXTN7OF5fQkN5WYow +BEN2dkGQGWJtSzqGTICJgnQuTJN/WJsojad9qXMuhIWdjXKjY4tenjo6tjVssk2gaWq3uGNX +U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz +7itICBxISKDBgwgTKjyYAAA7 +--DC8------------DC8638F443D87A7F0726DEF7-- + +--D7F------------D7FD5A0B8AB9C65CCDBFA872-- diff --git a/tests/resources/jmap_mail_parse/attachment.json b/tests/resources/jmap_mail_parse/attachment.json new file mode 100644 index 00000000..52f3ed0d --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment.json @@ -0,0 +1,187 @@ +{ + "mailboxIds": null, + "size": 1979, + "messageId": [ + "199804130742.RAA20366@mai1host.whitehouse.gov" + ], + "from": [ + { + "name": "Bill Clinton", + "email": "president@whitehouse.gov" + } + ], + "to": [ + { + "name": "A1 Gore (The Enforcer)", + "email": "vice-president@whitehouse.gov" + } + ], + "subject": "Map of Argentina with Description", + "sentAt": "1998-08-13T07:42:41Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/mixed;\n boundary=\"DC8------------DC8638F443D87A7F0726DEF7\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 355, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=us-ascii" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 288, + "headers": [ + { + "name": "Content-Type", + "value": " image/gif; name=\"map_of_Argentina.gif\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; fi1ename=\"map_of_Argentina.gif\"" + } + ], + "name": "map_of_Argentina.gif", + "type": "image/gif", + "disposition": "inline" + } + ] + }, + "bodyValues": { + "1": { + "value": "Hi A1,\n\nI finally figured out this MIME thing. Pretty cool. I'll send you\nsome sax music in .au...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 355, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=us-ascii" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 288, + "headers": [ + { + "name": "Content-Type", + "value": " image/gif; name=\"map_of_Argentina.gif\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; fi1ename=\"map_of_Argentina.gif\"" + } + ], + "name": "map_of_Argentina.gif", + "type": "image/gif", + "disposition": "inline" + } + ], + "htmlBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 355, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=us-ascii" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 288, + "headers": [ + { + "name": "Content-Type", + "value": " image/gif; name=\"map_of_Argentina.gif\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; fi1ename=\"map_of_Argentina.gif\"" + } + ], + "name": "map_of_Argentina.gif", + "type": "image/gif", + "disposition": "inline" + } + ], + "attachments": [ + { + "partId": "2", + "blobId": "blob_1", + "size": 288, + "headers": [ + { + "name": "Content-Type", + "value": " image/gif; name=\"map_of_Argentina.gif\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + }, + { + "name": "Content-Disposition", + "value": " inline; fi1ename=\"map_of_Argentina.gif\"" + } + ], + "name": "map_of_Argentina.gif", + "type": "image/gif", + "disposition": "inline" + } + ], + "hasAttachment": false, + "preview": "Hi A1,\n\nI finally figured out this MIME thing. Pretty cool. I'll send you\nsome sax music in .au files next week!\n\nAnyway, the attached image is really too small to get a good look at\nArgentina. Try this for a much better map:\n\n http://www.1one1yp..." +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_parse/attachment.part1 b/tests/resources/jmap_mail_parse/attachment.part1 new file mode 100644 index 00000000..0ea09a33 --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment.part1 @@ -0,0 +1,13 @@ +Hi A1, + +I finally figured out this MIME thing. Pretty cool. I'll send you +some sax music in .au files next week! + +Anyway, the attached image is really too small to get a good look at +Argentina. Try this for a much better map: + + http://www.1one1yp1anet.com/dest/sam/graphics/map-arg.htm + +Then again, shouldn't the CIA have something like that? + +Bill \ No newline at end of file diff --git a/tests/resources/jmap_mail_parse/attachment.part2 b/tests/resources/jmap_mail_parse/attachment.part2 new file mode 100644 index 0000000000000000000000000000000000000000..ccf0fd2bda3e0cd7880a66d0d58658f2348b0b74 GIT binary patch literal 288 zcmZ?wb+fQdRAn$_Sj52a9|(Sb`2S*7ZEYV=xy z+e5Pya-VO16Snro#Xzrl(`1i)*k!ye?%}EDbE=m;YOc}=D$T3&jWw>eh>Le}u8iz5 zU~w)hbDSWVl z_8rOL!OPr^9p5zh$gB-H=IR$Gp1pEmvTl;h?K?J?Jsuj})4YCWzplQ~qSs2d-yQvM h?bEZzJ0HANd;a;Iwg-odhsT10%^bp7HZvF)tO2XFgX;hQ literal 0 HcmV?d00001 diff --git a/tests/resources/jmap_mail_parse/attachment.part3 b/tests/resources/jmap_mail_parse/attachment.part3 new file mode 100644 index 00000000..4d31e86b --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment.part3 @@ -0,0 +1 @@ +Hi A1,

I finally figured out this MIME thing. Pretty cool. I'll send you
some sax music in .au files next week!

Anyway, the attached image is really too small to get a good look at
Argentina. Try this for a much better map:

http://www.1one1yp1anet.com/dest/sam/graphics/map-arg.htm

Then again, shouldn't the CIA have something like that?

Bill \ No newline at end of file diff --git a/tests/resources/jmap_mail_parse/attachment_b64.eml b/tests/resources/jmap_mail_parse/attachment_b64.eml new file mode 100644 index 00000000..c35e1c3d --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment_b64.eml @@ -0,0 +1,30 @@ +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-- diff --git a/tests/resources/jmap_mail_parse/attachment_b64.json b/tests/resources/jmap_mail_parse/attachment_b64.json new file mode 100644 index 00000000..777209c4 --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment_b64.json @@ -0,0 +1,127 @@ +{ + "mailboxIds": null, + "size": 872, + "messageId": [ + "random-message-id@example.com" + ], + "from": [ + { + "name": "Name", + "email": "email@example.com" + } + ], + "to": [ + { + "name": "email@example.com", + "email": "email@example.com" + } + ], + "subject": "HTML test", + "sentAt": "2021-12-14T10:48:25Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/alternative;\r\n boundary=\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"" + }, + { + "name": "Content-Language", + "value": " en-US" + } + ], + "type": "multipart/alternative", + "language": [ + "en-US" + ], + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 30, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=utf-8; format=flowed" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8" + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 173, + "headers": [ + { + "name": "Content-Type", + "value": " text/html; charset=utf-8" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "utf-8" + } + ] + }, + "bodyValues": { + "1": { + "value": "This is an *HTML* test message", + "isEncodingProblem": false, + "isTruncated": false + }, + "2": { + "value": "\n \n \n ...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 30, + "headers": [ + { + "name": "Content-Type", + "value": " text/plain; charset=utf-8; format=flowed" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8" + } + ], + "htmlBody": [ + { + "partId": "2", + "blobId": "blob_1", + "size": 173, + "headers": [ + { + "name": "Content-Type", + "value": " text/html; charset=utf-8" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "utf-8" + } + ], + "attachments": [], + "hasAttachment": false, + "preview": "This is an *HTML* test message" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_parse/attachment_b64.part1 b/tests/resources/jmap_mail_parse/attachment_b64.part1 new file mode 100644 index 00000000..90c04c57 --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment_b64.part1 @@ -0,0 +1 @@ +This is an *HTML* test message \ No newline at end of file diff --git a/tests/resources/jmap_mail_parse/attachment_b64.part2 b/tests/resources/jmap_mail_parse/attachment_b64.part2 new file mode 100644 index 00000000..172c94f5 --- /dev/null +++ b/tests/resources/jmap_mail_parse/attachment_b64.part2 @@ -0,0 +1,8 @@ + + + + + + This is an HTML test message + + diff --git a/tests/resources/jmap_mail_parse/headers.eml b/tests/resources/jmap_mail_parse/headers.eml new file mode 100644 index 00000000..11983a6a --- /dev/null +++ b/tests/resources/jmap_mail_parse/headers.eml @@ -0,0 +1,98 @@ +From: Art Vandelay (Vandelay Industries) +To: " James Smythe" , Friends: + jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= + ; +Cc: List 1: addr1@test.com, addr2@test.com; List 2: addr3@test.com, + addr4@test.com; addr5@test.com, addr6@test.com +Cc: =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: addr1@test.com, + addr2@test.com; =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: + addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com +Bcc: Greg Vaudreuil , Ned Freed + , Keith Moore +Bcc: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se +Date: Tue, 1 Jul 2003 10:52:37 +0200 +Resent-Date: Tue, 2 Jul 2005 11:52:37 +0200 +Resent-Date: Tue, 3 Jul 2005 12:52:37 +0300 +Resent-Date: Tue, 4 Jul 2005 13:52:37 +0400 +Message-ID: <5678.21-Nov-1997@example.com> +References: <1234@local.machine.example> + <3456@example.net> +References: <789@local.machine.example> + +Keywords: multipart, alternative, example +List-Post: (Postings are Moderated) +List-Subscribe: (Use this command to join the list) + +List-Subscribe: (FTP), + +List-Owner: , + +List-Unsubscribe: (Use this command to get off the list) + +Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?= +X-Address-Single: =?ISO-8859-1?Q?Andr=E9?= Pirard +X-Address: Mary Smith +X-Address: John Doe +X-AddressList-Single: Mary Smith , jdoe@example.org, Who? +X-AddressList: =?US-ASCII*EN?Q?Keith_Moore?= , + John =?US-ASCII*EN?Q?Doe?= +X-AddressList: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= , + =?ISO-8859-1?Q?Olle_J=E4rnefors?= +X-AddressesGroup-Single: A Group(Some people) + :Chris Jones , + joe@example.org, John (my dear + friend); (the end of the group) +X-AddressesGroup: A Group:Ed Jones ,joe@where.test,John ; +X-AddressesGroup: "List 1": addr1@test.com, addr2@test.com; "List 2": + addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com +X-List-Single: (X-Postings are Moderated) +X-List: , + +X-List: , + +X-Text-Single: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= + =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?= +X-Text: =?iso-8859-1?q?this=20is=20some=20text?= +X-Text: =?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?= +X-Date-Single: Tue, 5 Jul 2006 13:52:37 -0500 +X-Date: Sat, 20 Nov 2021 14:22:01 -0800 +X-Date: Sun, 21 Nov 2021 15:23:02 -0900 +X-Id-Single: +X-Id: +X-Id: +Content-Type: multipart/mixed; boundary="festivus"; + +--festivus +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: base64 +X-Custom-Header: 123 + +PGh0bWw+PHA+SSB3YXMgdGhpbmtpbmcgYWJvdXQgcXVpdHRpbmcgdGhlICZsZHF1bztle +HBvcnRpbmcmcmRxdW87IHRvIGZvY3VzIGp1c3Qgb24gdGhlICZsZHF1bztpbXBvcnRpbm +cmcmRxdW87LDwvcD48cD5idXQgdGhlbiBJIHRob3VnaHQsIHdoeSBub3QgZG8gYm90aD8 +gJiN4MjYzQTs8L3A+PC9odG1sPg== +--festivus +Content-Type: message/rfc822 +X-Custom-Header-2: 345 + +From: "Cosmo Kramer" +Subject: Exporting my book about coffee tables +Content-Type: multipart/mixed; boundary="giddyup"; + +--giddyup +Content-Type: text/plain; charset="utf-16" +Content-Transfer-Encoding: quoted-printable + +=FF=FE=0C!5=D8"=DD5=D8)=DD5=D8-=DD =005=D8*=DD5=D8"=DD =005=D8"= +=DD5=D85=DD5=D8-=DD5=D8,=DD5=D8/=DD5=D81=DD =005=D8*=DD5=D86=DD = +=005=D8=1F=DD5=D8,=DD5=D8,=DD5=D8(=DD =005=D8-=DD5=D8)=DD5=D8"= +=DD5=D8=1E=DD5=D80=DD5=D8"=DD!=00 +--giddyup +Content-Type: image/gif; name*1="about "; name*0="Book "; + name*2*=utf-8''%e2%98%95 tables.gif +Content-Transfer-Encoding: Base64 +Content-Disposition: attachment + +R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +--giddyup-- +--festivus-- diff --git a/tests/resources/jmap_mail_parse/headers.json b/tests/resources/jmap_mail_parse/headers.json new file mode 100644 index 00000000..eef7ad64 --- /dev/null +++ b/tests/resources/jmap_mail_parse/headers.json @@ -0,0 +1,1257 @@ +{ + "mailboxIds": null, + "messageId": [ + "5678.21-Nov-1997@example.com" + ], + "references": [ + "789@local.machine.example", + "abcd@example.net" + ], + "from": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ], + "to": [ + { + "name": " James Smythe", + "email": "james@example.com" + }, + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ], + "cc": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + "bcc": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ], + "subject": "Why not both importing AND exporting? ☺", + "sentAt": "2003-07-01T08:52:37Z", + "textBody": [ + { + "size": 175, + "type": "text/html", + "charset": "us-ascii" + } + ], + "htmlBody": [ + { + "size": 175, + "type": "text/html", + "charset": "us-ascii" + } + ], + "attachments": [ + { + "size": 723, + "type": "message/rfc822" + } + ], + "preview": "I was thinking about quitting the “exporting” to focus just on the “importing”,\nbut then I thought, why not do both? ☺\n", + "header:Bcc": " ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se", + "header:Bcc:all": [ + " Greg Vaudreuil , Ned Freed\n , Keith Moore ", + " ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se" + ], + "header:Bcc:asAddresses": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ], + "header:Bcc:asAddresses:all": [ + [ + { + "name": "Greg Vaudreuil", + "email": "gvaudre@NRI.Reston.VA.US" + }, + { + "name": "Ned Freed", + "email": "ned@innosoft.com" + }, + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + } + ], + [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ] + ], + "header:Bcc:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ] + } + ], + "header:Bcc:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Greg Vaudreuil", + "email": "gvaudre@NRI.Reston.VA.US" + }, + { + "name": "Ned Freed", + "email": "ned@innosoft.com" + }, + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + } + ] + } + ], + [ + { + "name": null, + "addresses": [ + { + "name": null, + "email": "ietf-822@dimacs.rutgers.edu" + }, + { + "name": null, + "email": "ojarnef@admin.kth.se" + } + ] + } + ] + ], + "header:Cc": " =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: addr1@test.com, \n addr2@test.com; =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com", + "header:Cc:all": [ + " List 1: addr1@test.com, addr2@test.com; List 2: addr3@test.com, \n addr4@test.com; addr5@test.com, addr6@test.com", + " =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: addr1@test.com, \n addr2@test.com; =?utf-8?b?VGjDrXMgw61zIHbDoWzDrWQgw5pURjg=?=: \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com" + ], + "header:Cc:asAddresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + "header:Cc:asAddresses:all": [ + [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + ], + "header:Cc:asGroupedAddresses": [ + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ], + "header:Cc:asGroupedAddresses:all": [ + [ + { + "name": "List 1", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "List 2", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ], + [ + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "Thís ís válíd ÚTF8", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ] + ], + "header:Date": " Tue, 1 Jul 2003 10:52:37 +0200", + "header:Date:all": [ + " Tue, 1 Jul 2003 10:52:37 +0200" + ], + "header:Date:asDate": "2003-07-01T08:52:37Z", + "header:Date:asDate:all": [ + "2003-07-01T08:52:37Z" + ], + "header:From": " Art Vandelay (Vandelay Industries)", + "header:From:all": [ + " Art Vandelay (Vandelay Industries)" + ], + "header:From:asAddresses": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ], + "header:From:asAddresses:all": [ + [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ] + ], + "header:From:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ] + } + ], + "header:From:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ] + } + ] + ], + "header:Keywords": " multipart, alternative, example", + "header:Keywords:all": [ + " multipart, alternative, example" + ], + "header:Keywords:asText": "multipart, alternative, example", + "header:Keywords:asText:all": [ + "multipart, alternative, example" + ], + "header:List-Owner": " ,\n ", + "header:List-Owner:all": [ + " ,\n " + ], + "header:List-Owner:asURLs": [ + "http://www.host.com/list.cgi?cmd=sub&lst=list", + "mailto:list-manager@host.com?body=subscribe%20list" + ], + "header:List-Owner:asURLs:all": [ + [ + "http://www.host.com/list.cgi?cmd=sub&lst=list", + "mailto:list-manager@host.com?body=subscribe%20list" + ] + ], + "header:List-Post": " (Postings are Moderated)", + "header:List-Post:all": [ + " (Postings are Moderated)" + ], + "header:List-Post:asURLs": [ + "mailto:moderator@host.com" + ], + "header:List-Post:asURLs:all": [ + [ + "mailto:moderator@host.com" + ] + ], + "header:List-Subscribe": " (FTP), \n ", + "header:List-Subscribe:all": [ + " (Use this command to join the list)\n ", + " (FTP), \n " + ], + "header:List-Subscribe:asURLs": [ + "ftp://ftp.host.com/list.txt", + "mailto:list@host.com?subject=subscribe" + ], + "header:List-Subscribe:asURLs:all": [ + [ + "mailto:list-manager@host.com?body=subscribe%20list" + ], + [ + "ftp://ftp.host.com/list.txt", + "mailto:list@host.com?subject=subscribe" + ] + ], + "header:List-Unsubscribe": " (Use this command to get off the list)\n ", + "header:List-Unsubscribe:all": [ + " (Use this command to get off the list)\n " + ], + "header:List-Unsubscribe:asURLs": [ + "mailto:list-manager@host.com?body=unsubscribe%20list" + ], + "header:List-Unsubscribe:asURLs:all": [ + [ + "mailto:list-manager@host.com?body=unsubscribe%20list" + ] + ], + "header:Message-ID": " <5678.21-Nov-1997@example.com>", + "header:Message-ID:all": [ + " <5678.21-Nov-1997@example.com>" + ], + "header:Message-ID:asMessageIds": [ + "5678.21-Nov-1997@example.com" + ], + "header:Message-ID:asMessageIds:all": [ + [ + "5678.21-Nov-1997@example.com" + ] + ], + "header:References": " <789@local.machine.example>\n ", + "header:References:all": [ + " <1234@local.machine.example>\n <3456@example.net>", + " <789@local.machine.example>\n " + ], + "header:References:asMessageIds": [ + "789@local.machine.example", + "abcd@example.net" + ], + "header:References:asMessageIds:all": [ + [ + "1234@local.machine.example", + "3456@example.net" + ], + [ + "789@local.machine.example", + "abcd@example.net" + ] + ], + "header:Resent-Date": " Tue, 4 Jul 2005 13:52:37 +0400", + "header:Resent-Date:all": [ + " Tue, 2 Jul 2005 11:52:37 +0200", + " Tue, 3 Jul 2005 12:52:37 +0300", + " Tue, 4 Jul 2005 13:52:37 +0400" + ], + "header:Resent-Date:asDate": "2005-07-04T09:52:37Z", + "header:Resent-Date:asDate:all": [ + "2005-07-02T09:52:37Z", + "2005-07-03T09:52:37Z", + "2005-07-04T09:52:37Z" + ], + "header:Subject": " Why not both importing AND exporting? =?utf-8?b?4pi6?=", + "header:Subject:all": [ + " Why not both importing AND exporting? =?utf-8?b?4pi6?=" + ], + "header:Subject:asText": "Why not both importing AND exporting? ☺", + "header:Subject:asText:all": [ + "Why not both importing AND exporting? ☺" + ], + "header:To": " \" James Smythe\" , Friends:\n jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?=\n ;", + "header:To:all": [ + " \" James Smythe\" , Friends:\n jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?=\n ;" + ], + "header:To:asAddresses": [ + { + "name": " James Smythe", + "email": "james@example.com" + }, + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ], + "header:To:asAddresses:all": [ + [ + { + "name": " James Smythe", + "email": "james@example.com" + }, + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ] + ], + "header:To:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": " James Smythe", + "email": "james@example.com" + } + ] + }, + { + "name": "Friends", + "addresses": [ + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ] + } + ], + "header:To:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": " James Smythe", + "email": "james@example.com" + } + ] + }, + { + "name": "Friends", + "addresses": [ + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ] + } + ] + ], + "header:X-Address": " John Doe ", + "header:X-Address:all": [ + " Mary Smith ", + " John Doe " + ], + "header:X-Address:asAddresses": [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ], + "header:X-Address:asAddresses:all": [ + [ + { + "name": "Mary Smith", + "email": "mary@example.net" + } + ], + [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ] + ], + "header:X-Address:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ] + } + ], + "header:X-Address:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Mary Smith", + "email": "mary@example.net" + } + ] + } + ], + [ + { + "name": null, + "addresses": [ + { + "name": "John Doe", + "email": "jdoe@machine.example" + } + ] + } + ] + ], + "header:X-Address-Single": " =?ISO-8859-1?Q?Andr=E9?= Pirard ", + "header:X-Address-Single:all": [ + " =?ISO-8859-1?Q?Andr=E9?= Pirard " + ], + "header:X-Address-Single:asAddresses": [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ], + "header:X-Address-Single:asAddresses:all": [ + [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ] + ], + "header:X-Address-Single:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ] + } + ], + "header:X-Address-Single:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "André Pirard", + "email": "PIRARD@vm1.ulg.ac.be" + } + ] + } + ] + ], + "header:X-AddressList": " =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= ,\n =?ISO-8859-1?Q?Olle_J=E4rnefors?= ", + "header:X-AddressList:all": [ + " =?US-ASCII*EN?Q?Keith_Moore?= , \n John =?US-ASCII*EN?Q?Doe?= ", + " =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= ,\n =?ISO-8859-1?Q?Olle_J=E4rnefors?= " + ], + "header:X-AddressList:asAddresses": [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ], + "header:X-AddressList:asAddresses:all": [ + [ + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + }, + { + "name": "John Doe", + "email": "moore@cs.utk.edu" + } + ], + [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ] + ], + "header:X-AddressList:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ] + } + ], + "header:X-AddressList:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + }, + { + "name": "John Doe", + "email": "moore@cs.utk.edu" + } + ] + } + ], + [ + { + "name": null, + "addresses": [ + { + "name": "Keld Jørn Simonsen", + "email": "keld@dkuug.dk" + }, + { + "name": "Olle Järnefors", + "email": "ojarnef@admin.kth.se" + } + ] + } + ] + ], + "header:X-AddressList-Single": " Mary Smith , jdoe@example.org, Who? ", + "header:X-AddressList-Single:all": [ + " Mary Smith , jdoe@example.org, Who? " + ], + "header:X-AddressList-Single:asAddresses": [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ], + "header:X-AddressList-Single:asAddresses:all": [ + [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ] + ], + "header:X-AddressList-Single:asGroupedAddresses": [ + { + "name": null, + "addresses": [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ] + } + ], + "header:X-AddressList-Single:asGroupedAddresses:all": [ + [ + { + "name": null, + "addresses": [ + { + "name": "Mary Smith", + "email": "mary@x.test" + }, + { + "name": null, + "email": "jdoe@example.org" + }, + { + "name": "Who?", + "email": "one@y.test" + } + ] + } + ] + ], + "header:X-AddressesGroup": " \"List 1\": addr1@test.com, addr2@test.com; \"List 2\": \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com", + "header:X-AddressesGroup:all": [ + " A Group:Ed Jones ,joe@where.test,John ;", + " \"List 1\": addr1@test.com, addr2@test.com; \"List 2\": \n addr3@test.com, addr4@test.com; addr5@test.com, addr6@test.com" + ], + "header:X-AddressesGroup:asAddresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ], + "header:X-AddressesGroup:asAddresses:all": [ + [ + { + "name": "Ed Jones", + "email": "c@a.test" + }, + { + "name": null, + "email": "joe@where.test" + }, + { + "name": "John", + "email": "jdoe@one.test" + } + ], + [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + }, + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + }, + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + ], + "header:X-AddressesGroup:asGroupedAddresses": [ + { + "name": "List 1", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "List 2", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ], + "header:X-AddressesGroup:asGroupedAddresses:all": [ + [ + { + "name": "A Group", + "addresses": [ + { + "name": "Ed Jones", + "email": "c@a.test" + }, + { + "name": null, + "email": "joe@where.test" + }, + { + "name": "John", + "email": "jdoe@one.test" + } + ] + } + ], + [ + { + "name": "List 1", + "addresses": [ + { + "name": null, + "email": "addr1@test.com" + }, + { + "name": null, + "email": "addr2@test.com" + } + ] + }, + { + "name": "List 2", + "addresses": [ + { + "name": null, + "email": "addr3@test.com" + }, + { + "name": null, + "email": "addr4@test.com" + } + ] + }, + { + "name": null, + "addresses": [ + { + "name": null, + "email": "addr5@test.com" + }, + { + "name": null, + "email": "addr6@test.com" + } + ] + } + ] + ], + "header:X-AddressesGroup-Single": " A Group(Some people)\n :Chris Jones ,\n joe@example.org, John (my dear\n friend); (the end of the group)", + "header:X-AddressesGroup-Single:all": [ + " A Group(Some people)\n :Chris Jones ,\n joe@example.org, John (my dear\n friend); (the end of the group)" + ], + "header:X-AddressesGroup-Single:asAddresses": [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ], + "header:X-AddressesGroup-Single:asAddresses:all": [ + [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ] + ], + "header:X-AddressesGroup-Single:asGroupedAddresses": [ + { + "name": "A Group (Some people)", + "addresses": [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ] + }, + { + "name": null, + "addresses": [] + } + ], + "header:X-AddressesGroup-Single:asGroupedAddresses:all": [ + [ + { + "name": "A Group (Some people)", + "addresses": [ + { + "name": "Chris Jones (Chris's host.)", + "email": "c@public.example" + }, + { + "name": null, + "email": "joe@example.org" + }, + { + "name": "John (my dear friend)", + "email": "jdoe@one.test" + } + ] + }, + { + "name": null, + "addresses": [] + } + ] + ], + "header:X-Date": " Sun, 21 Nov 2021 15:23:02 -0900", + "header:X-Date:all": [ + " Sat, 20 Nov 2021 14:22:01 -0800", + " Sun, 21 Nov 2021 15:23:02 -0900" + ], + "header:X-Date:asDate": "2021-11-22T00:23:02Z", + "header:X-Date:asDate:all": [ + "2021-11-20T22:22:01Z", + "2021-11-22T00:23:02Z" + ], + "header:X-Date-Single": " Tue, 5 Jul 2006 13:52:37 -0500", + "header:X-Date-Single:all": [ + " Tue, 5 Jul 2006 13:52:37 -0500" + ], + "header:X-Date-Single:asDate": "2006-07-05T18:52:37Z", + "header:X-Date-Single:asDate:all": [ + "2006-07-05T18:52:37Z" + ], + "header:X-Id": " ", + "header:X-Id:all": [ + " ", + " " + ], + "header:X-Id:asMessageIds": [ + "myid4@example.com", + "myid5@example.com" + ], + "header:X-Id:asMessageIds:all": [ + [ + "myid3@example.com" + ], + [ + "myid4@example.com", + "myid5@example.com" + ] + ], + "header:X-Id-Single": " ", + "header:X-Id-Single:all": [ + " " + ], + "header:X-Id-Single:asMessageIds": [ + "myid@example.com", + "myid2@example.com" + ], + "header:X-Id-Single:asMessageIds:all": [ + [ + "myid@example.com", + "myid2@example.com" + ] + ], + "header:X-List": " ,\n ", + "header:X-List:all": [ + " ,\n ", + " ,\n " + ], + "header:X-List:asURLs": [ + "http://www.mylist2.com/list2", + "mailto:list2@mylist2.com" + ], + "header:X-List:asURLs:all": [ + [ + "http://www.mylist.com/list", + "mailto:list@mylist.com" + ], + [ + "http://www.mylist2.com/list2", + "mailto:list2@mylist2.com" + ] + ], + "header:X-List-Single": " (X-Postings are Moderated)", + "header:X-List-Single:all": [ + " (X-Postings are Moderated)" + ], + "header:X-List-Single:asURLs": [ + "mailto:x-moderator@host.com" + ], + "header:X-List-Single:asURLs:all": [ + [ + "mailto:x-moderator@host.com" + ] + ], + "header:X-Text": " =?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=", + "header:X-Text:all": [ + " =?iso-8859-1?q?this=20is=20some=20text?=", + " =?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=" + ], + "header:X-Text:asText": "a b", + "header:X-Text:asText:all": [ + "this is some text", + "a b" + ], + "header:X-Text-Single": " =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\n =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=", + "header:X-Text-Single:all": [ + " =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\n =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=" + ], + "header:X-Text-Single:asText": "If you can read this you understand the example.", + "header:X-Text-Single:asText:all": [ + "If you can read this you understand the example." + ] +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/headers.eml b/tests/resources/jmap_mail_set/headers.eml new file mode 100644 index 00000000..53ea559d --- /dev/null +++ b/tests/resources/jmap_mail_set/headers.eml @@ -0,0 +1,51 @@ +Bcc: "=?utf-8?B?wqFFbCDDsWFuZMO6IGNvbWnDsyDDsW9xdWlzIQ==?=" + +Cc: "=?utf-8?B?0J/RgNC40LLQtdGCLCDQvNC40YA=?=" +Date: Tue, 10 Jul 2018 01:03:11 +0000 +From: "Joe Bloggs" +In-Reply-To: +List-Owner: , + +List-Subscribe: , + +List-Subscribe: +Message-ID: +References: +Reply-To: "=?utf-8?B?7JWI64WV7ZWY7IS47JqUIOyEuOqzhA==?=" , + "=?utf-8?Q?Antoine_de_Saint-Exup=C3=A9ry?=" +Resent-Date: Sat, 2 Jul 2005 09:52:37 +0000 +Resent-Date: Sun, 3 Jul 2005 09:52:37 +0000 +Resent-Date: Mon, 4 Jul 2005 09:52:37 +0000 +Sender: "=?utf-8?B?44OP44Ot44O844O744Ov44O844Or44OJ?=" +Subject: Headers test +To: "Greg Vaudreuil" , + "Ned Freed" , "Keith Moore" +X-AddressesGroup: "A Group": "Ed Jones" , + , "John" +X-AddressesGroup: "List 1": , + ; "List 2": , + ; , + +X-References: <1234@local.machine.example> <3456@example.net> +X-References: <789@local.machine.example> +X-Text: a b +X-Text: this is some text +Content-Type: multipart/alternative; + boundary="boundary_0" + + +--boundary_0 +Content-Language: en +Content-Type: text/plain; charset="us-ascii" +X-Header: just a value +X-Text: more text +Content-Transfer-Encoding: 7bit + +I have the most brilliant plan. Let me tell you all about it. What we do is, we +--boundary_0 +Content-Location: https://example.com/html-body.html +Content-Type: text/html; charset="utf-8"; name="html-body.html" +Content-Transfer-Encoding: 7bit + +
I have the most brilliant plan. Let me tell you all about it. What we do is, we
+--boundary_0-- diff --git a/tests/resources/jmap_mail_set/headers.jmap b/tests/resources/jmap_mail_set/headers.jmap new file mode 100644 index 00000000..d0697e12 --- /dev/null +++ b/tests/resources/jmap_mail_set/headers.jmap @@ -0,0 +1,304 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "$draft": true, + "$seen": true + }, + "receivedAt": "2018-07-10T01:03:11Z", + "messageId": [ + "my-message-id" + ], + "inReplyTo": [ + "other-message-id", + "yet-another-message-id" + ], + "references": [ + "first-message-id", + "second-message-id" + ], + "sender": [ + { + "name": "ハロー・ワールド", + "email": "joe@example.com" + } + ], + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "to": [ + { + "name": "Greg Vaudreuil", + "email": "gvaudre@NRI.Reston.VA.US" + }, + { + "name": "Ned Freed", + "email": "ned@innosoft.com" + }, + { + "name": "Keith Moore", + "email": "moore@cs.utk.edu" + } + ], + "cc": [ + { + "name": "Привет, мир", + "email": "addr0@example.com" + } + ], + "bcc": [ + { + "name": "¡El ñandú comió ñoquis!", + "email": "addr1@example.com" + } + ], + "replyTo": [ + { + "name": "안녕하세요 세계", + "email": "addr2@example.com" + }, + { + "name": "Antoine de Saint-Exupéry", + "email": "addr3@example.com" + } + ], + "subject": "Headers test", + "sentAt": "2018-07-10T01:03:11Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Bcc", + "value": " \"=?utf-8?B?wqFFbCDDsWFuZMO6IGNvbWnDsyDDsW9xdWlzIQ==?=\"\r\n\t" + }, + { + "name": "Cc", + "value": " \"=?utf-8?B?0J/RgNC40LLQtdGCLCDQvNC40YA=?=\" " + }, + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "From", + "value": " \"Joe Bloggs\" " + }, + { + "name": "In-Reply-To", + "value": " " + }, + { + "name": "List-Owner", + "value": " ,\r\n\t" + }, + { + "name": "List-Subscribe", + "value": " ,\r\n\t" + }, + { + "name": "List-Subscribe", + "value": " " + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "References", + "value": " " + }, + { + "name": "Reply-To", + "value": " \"=?utf-8?B?7JWI64WV7ZWY7IS47JqUIOyEuOqzhA==?=\" , \r\n\t\"=?utf-8?Q?Antoine_de_Saint-Exup=C3=A9ry?=\" " + }, + { + "name": "Resent-Date", + "value": " Sat, 2 Jul 2005 09:52:37 +0000" + }, + { + "name": "Resent-Date", + "value": " Sun, 3 Jul 2005 09:52:37 +0000" + }, + { + "name": "Resent-Date", + "value": " Mon, 4 Jul 2005 09:52:37 +0000" + }, + { + "name": "Sender", + "value": " \"=?utf-8?B?44OP44Ot44O844O744Ov44O844Or44OJ?=\" " + }, + { + "name": "Subject", + "value": " Headers test" + }, + { + "name": "To", + "value": " \"Greg Vaudreuil\" , \r\n\t\"Ned Freed\" , \"Keith Moore\" " + }, + { + "name": "X-AddressesGroup", + "value": " \"A Group\": \"Ed Jones\" , \r\n\t, \"John\" " + }, + { + "name": "X-AddressesGroup", + "value": " \"List 1\": , \r\n\t; \"List 2\": , \r\n\t; , \r\n\t" + }, + { + "name": "X-References", + "value": " <1234@local.machine.example> <3456@example.net>" + }, + { + "name": "X-References", + "value": " <789@local.machine.example> " + }, + { + "name": "X-Text", + "value": " a b" + }, + { + "name": "X-Text", + "value": " this is some text" + }, + { + "name": "Content-Type", + "value": " multipart/alternative; \r\n\tboundary=\"boundary_0\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 81, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"us-ascii\"" + }, + { + "name": "X-Header", + "value": " just a value" + }, + { + "name": "X-Text", + "value": " more text" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "language": [ + "en" + ] + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 218, + "headers": [ + { + "name": "Content-Location", + "value": " https://example.com/html-body.html" + }, + { + "name": "Content-Type", + "value": " text/html; charset=\"utf-8\"; name=\"html-body.html\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "name": "html-body.html", + "type": "text/html", + "charset": "utf-8", + "location": "https://example.com/html-body.html" + } + ] + }, + "bodyValues": { + "1": { + "value": "I have the most brilliant plan. Let me tell you all about it. What we do is, we", + "isEncodingProblem": false, + "isTruncated": false + }, + "2": { + "value": "...", + "isEncodingProblem": false, + "isTruncated": true + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 81, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"us-ascii\"" + }, + { + "name": "X-Header", + "value": " just a value" + }, + { + "name": "X-Text", + "value": " more text" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "language": [ + "en" + ] + } + ], + "htmlBody": [ + { + "partId": "2", + "blobId": "blob_1", + "size": 218, + "headers": [ + { + "name": "Content-Location", + "value": " https://example.com/html-body.html" + }, + { + "name": "Content-Type", + "value": " text/html; charset=\"utf-8\"; name=\"html-body.html\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "name": "html-body.html", + "type": "text/html", + "charset": "utf-8", + "location": "https://example.com/html-body.html" + } + ], + "attachments": [], + "hasAttachment": false, + "preview": "I have the most brilliant plan. Let me tell you all about it. What we do is, we" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/headers.json b/tests/resources/jmap_mail_set/headers.json new file mode 100644 index 00000000..ac98a059 --- /dev/null +++ b/tests/resources/jmap_mail_set/headers.json @@ -0,0 +1,186 @@ +{ + "keywords": { + "$seen": true, + "$draft": true + }, + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "subject": "Headers test", + "receivedAt": "2018-07-10T01:03:11Z", + "sentAt": "2018-07-10T11:03:11+10:00", + "messageId": [ + "my-message-id" + ], + "inReplyTo": [ + "other-message-id", + "yet-another-message-id" + ], + "references": [ + "first-message-id", + "second-message-id" + ], + "sender": [ + { + "name": "ハロー・ワールド", + "email": "joe@example.com" + } + ], + "to": [ + { + "email": "gvaudre@NRI.Reston.VA.US", + "name": "Greg Vaudreuil" + }, + { + "email": "ned@innosoft.com", + "name": "Ned Freed" + }, + { + "email": "moore@cs.utk.edu", + "name": "Keith Moore" + } + ], + "cc": [ + { + "name": "Привет, мир", + "email": "addr0@example.com" + } + ], + "bcc": [ + { + "name": "¡El ñandú comió ñoquis!", + "email": "addr1@example.com" + } + ], + "replyTo": [ + { + "name": "안녕하세요 세계", + "email": "addr2@example.com" + }, + { + "name": "Antoine de Saint-Exupéry", + "email": "addr3@example.com" + } + ], + "header:Resent-Date:asDate:all": [ + "2005-07-02T11:52:37+02:00", + "2005-07-03T12:52:37+03:00", + "2005-07-04T13:52:37+04:00" + ], + "header:X-Text:asText:all": [ + "this is some text", + "a b" + ], + "header:List-Owner:asURLs": [ + "http://www.host.com/list.cgi?cmd=sub&lst=list", + "mailto:list-manager@host.com?body=subscribe%20list" + ], + "header:List-Subscribe:asURLs:all": [ + [ + "mailto:list-manager@host.com?body=subscribe%20list" + ], + [ + "ftp://ftp.host.com/list.txt", + "mailto:list@host.com?subject=subscribe" + ] + ], + "header:X-References:asMessageIds:all": [ + [ + "1234@local.machine.example", + "3456@example.net" + ], + [ + "789@local.machine.example", + "abcd@example.net" + ] + ], + "header:X-AddressesGroup:asGroupedAddresses:all": [ + [ + { + "addresses": [ + { + "email": "c@a.test", + "name": "Ed Jones" + }, + { + "email": "joe@where.test", + "name": null + }, + { + "email": "jdoe@one.test", + "name": "John" + } + ], + "name": "A Group" + } + ], + [ + { + "addresses": [ + { + "email": "addr1@test.com", + "name": null + }, + { + "email": "addr2@test.com", + "name": null + } + ], + "name": "List 1" + }, + { + "addresses": [ + { + "email": "addr3@test.com", + "name": null + }, + { + "email": "addr4@test.com", + "name": null + } + ], + "name": "List 2" + }, + { + "addresses": [ + { + "email": "addr5@test.com", + "name": null + }, + { + "email": "addr6@test.com", + "name": null + } + ], + "name": null + } + ] + ], + "textBody": [ + { + "type": "text/plain", + "blobId": "I have the most brilliant plan. Let me tell you all about it. What we do is, we", + "charset": "us-ascii", + "header:Content-Language": "en", + "header:X-Header": "just a value", + "header:X-Text": "more text" + } + ], + "htmlBody": [ + { + "type": "text/html", + "partId": "a49d", + "location": "https://example.com/html-body.html", + "name": "html-body.html" + } + ], + "bodyValues": { + "a49d": { + "value": "
I have the most brilliant plan. Let me tell you all about it. What we do is, we
", + "isTruncated": false + } + } +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/minimal.eml b/tests/resources/jmap_mail_set/minimal.eml new file mode 100644 index 00000000..a9b4cb9d --- /dev/null +++ b/tests/resources/jmap_mail_set/minimal.eml @@ -0,0 +1,6 @@ +Date: Tue, 10 Jul 2018 01:03:11 +0000 +Message-ID: +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 7bit + + diff --git a/tests/resources/jmap_mail_set/minimal.jmap b/tests/resources/jmap_mail_set/minimal.jmap new file mode 100644 index 00000000..55ec7351 --- /dev/null +++ b/tests/resources/jmap_mail_set/minimal.jmap @@ -0,0 +1,100 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": {}, + "receivedAt": "2018-07-10T01:03:11Z", + "messageId": [ + "my-message-id" + ], + "sentAt": "2018-07-10T01:03:11Z", + "bodyStructure": { + "partId": "0", + "blobId": "blob_0", + "size": 2, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8" + }, + "bodyValues": { + "0": { + "value": "\n", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "0", + "blobId": "blob_0", + "size": 2, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8" + } + ], + "htmlBody": [ + { + "partId": "0", + "blobId": "blob_0", + "size": 2, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8" + } + ], + "attachments": [], + "hasAttachment": false, + "preview": "\n" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/minimal.json b/tests/resources/jmap_mail_set/minimal.json new file mode 100644 index 00000000..a39ef7b0 --- /dev/null +++ b/tests/resources/jmap_mail_set/minimal.json @@ -0,0 +1,7 @@ +{ + "receivedAt": "2018-07-10T01:03:11Z", + "sentAt": "2018-07-10T11:03:11+10:00", + "messageId": [ + "my-message-id" + ] +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/mixed.eml b/tests/resources/jmap_mail_set/mixed.eml new file mode 100644 index 00000000..a4864272 --- /dev/null +++ b/tests/resources/jmap_mail_set/mixed.eml @@ -0,0 +1,50 @@ +Date: Sat, 20 Nov 2021 22:22:01 +0000 +From: "Art Vandelay (Vandelay Industries)" +Message-ID: +Subject: =?utf-8?Q?Why_not_both_importing_AND_exporting=3F_=E2=98=BA?= +To: "Colleagues": "James Smythe" ; + "Friends": , + "=?utf-8?Q?John_Sm=C3=AEth?=" +Content-Type: multipart/mixed; + boundary="boundary_0" + + +--boundary_0 +Content-Type: multipart/alternative; + boundary="boundary_1" + + +--boundary_1 +Content-Language: en +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +I was thinking about quitting the =E2=80=9Cexporting=E2=80=9D to focus just = +on the =E2=80=9Cimporting=E2=80=9D, +but then I thought, why not do both? =E2=98=BA + +--boundary_1 +Content-Language: en_US +Content-Type: text/html +Content-Transfer-Encoding: 7bit + +

I was thinking about quitting the “exporting” to focus just on the “importing”,

but then I thought, why not do both? ☺

+--boundary_1-- + +--boundary_0 +Content-ID: +Content-Type: image/png +Content-Transfer-Encoding: base64 + +aGVyZSBhcmUgdGhlIGVtYmVkZGVkIGltYWdlIGNvbnRlbnRzIQ== + +--boundary_0 +Content-Disposition: attachment; filename="=?utf-8?Q?Book_about_=E2=98=95_tables.pdf?=" +Content-Type: x-document/pdf +Content-Transfer-Encoding: base64 + +PGh0bWw+PGJvZHk+4oSM8J2UovCdlKnwnZStIPCdlKrwnZSiIPCdlKLwnZS18J2UrfCdlKzwnZSv +8J2UsSDwnZSq8J2UtiDwnZSf8J2UrPCdlKzwnZSoIPCdlK3wnZSp8J2UovCdlJ7wnZSw8J2UoiE8 +L2JvZHk+PC9odG1sPg== + +--boundary_0-- diff --git a/tests/resources/jmap_mail_set/mixed.jmap b/tests/resources/jmap_mail_set/mixed.jmap new file mode 100644 index 00000000..7e810e1c --- /dev/null +++ b/tests/resources/jmap_mail_set/mixed.jmap @@ -0,0 +1,329 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "$draft": true, + "$seen": true, + "my-tag": true + }, + "receivedAt": "2021-11-20T22:22:01Z", + "messageId": [ + "my-message-id" + ], + "from": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ], + "to": [ + { + "name": "James Smythe", + "email": "james@vandelay.com" + }, + { + "name": null, + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ], + "subject": "Why not both importing AND exporting? ☺", + "sentAt": "2021-11-20T22:22:01Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Date", + "value": " Sat, 20 Nov 2021 22:22:01 +0000" + }, + { + "name": "From", + "value": " \"Art Vandelay (Vandelay Industries)\" " + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Subject", + "value": " =?utf-8?Q?Why_not_both_importing_AND_exporting=3F_=E2=98=BA?=" + }, + { + "name": "To", + "value": " \"Colleagues\": \"James Smythe\" ; \r\n\t\"Friends\": , \r\n\t\"=?utf-8?Q?John_Sm=C3=AEth?=\" " + }, + { + "name": "Content-Type", + "value": " multipart/mixed; \r\n\tboundary=\"boundary_0\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/alternative; \r\n\tboundary=\"boundary_1\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "partId": "2", + "blobId": "blob_0", + "size": 129, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "language": [ + "en" + ] + }, + { + "partId": "3", + "blobId": "blob_1", + "size": 175, + "headers": [ + { + "name": "Content-Language", + "value": " en_US" + }, + { + "name": "Content-Type", + "value": " text/html" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "us-ascii", + "language": [ + "en_US" + ] + } + ] + }, + { + "partId": "4", + "blobId": "blob_2", + "size": 37, + "headers": [ + { + "name": "Content-ID", + "value": " " + }, + { + "name": "Content-Type", + "value": " image/png" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/png", + "cid": "cid:1234-5678-9012-3456" + }, + { + "partId": "5", + "blobId": "blob_3", + "size": 127, + "headers": [ + { + "name": "Content-Disposition", + "value": " attachment; filename=\"=?utf-8?Q?Book_about_=E2=98=95_tables.pdf?=\"" + }, + { + "name": "Content-Type", + "value": " x-document/pdf" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "name": "Book about ☕ tables.pdf", + "type": "x-document/pdf", + "disposition": "attachment" + } + ] + }, + "bodyValues": { + "2": { + "value": "I was thinking about quitting the “exporting” to focus just on the “importing”,\nbut then ...", + "isEncodingProblem": false, + "isTruncated": true + }, + "3": { + "value": "

I was thinking about quitting the “exporting” to focus just on the “im...", + "isEncodingProblem": false, + "isTruncated": true + }, + "4": { + "value": "here are the embedded image contents!", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "2", + "blobId": "blob_0", + "size": 129, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " quoted-printable" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "language": [ + "en" + ] + }, + { + "partId": "4", + "blobId": "blob_2", + "size": 37, + "headers": [ + { + "name": "Content-ID", + "value": " " + }, + { + "name": "Content-Type", + "value": " image/png" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/png", + "cid": "cid:1234-5678-9012-3456" + } + ], + "htmlBody": [ + { + "partId": "3", + "blobId": "blob_1", + "size": 175, + "headers": [ + { + "name": "Content-Language", + "value": " en_US" + }, + { + "name": "Content-Type", + "value": " text/html" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "us-ascii", + "language": [ + "en_US" + ] + }, + { + "partId": "4", + "blobId": "blob_2", + "size": 37, + "headers": [ + { + "name": "Content-ID", + "value": " " + }, + { + "name": "Content-Type", + "value": " image/png" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/png", + "cid": "cid:1234-5678-9012-3456" + } + ], + "attachments": [ + { + "partId": "4", + "blobId": "blob_2", + "size": 37, + "headers": [ + { + "name": "Content-ID", + "value": " " + }, + { + "name": "Content-Type", + "value": " image/png" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/png", + "cid": "cid:1234-5678-9012-3456" + }, + { + "partId": "5", + "blobId": "blob_3", + "size": 127, + "headers": [ + { + "name": "Content-Disposition", + "value": " attachment; filename=\"=?utf-8?Q?Book_about_=E2=98=95_tables.pdf?=\"" + }, + { + "name": "Content-Type", + "value": " x-document/pdf" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "name": "Book about ☕ tables.pdf", + "type": "x-document/pdf", + "disposition": "attachment" + } + ], + "hasAttachment": true, + "preview": "I was thinking about quitting the “exporting” to focus just on the “importing”,\nbut then I thought, why not do both? ☺\n" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/mixed.json b/tests/resources/jmap_mail_set/mixed.json new file mode 100644 index 00000000..198fe0b5 --- /dev/null +++ b/tests/resources/jmap_mail_set/mixed.json @@ -0,0 +1,70 @@ +{ + "keywords": { + "$seen": true, + "$draft": true, + "my-tag": true, + "ignore-me": false + }, + "from": [ + { + "name": "Art Vandelay (Vandelay Industries)", + "email": "art@vandelay.com" + } + ], + "header:To:asGroupedAddresses": [ + { + "name": "Colleagues", + "addresses": [ + { + "name": "James Smythe", + "email": "james@vandelay.com" + } + ] + }, + { + "name": "Friends", + "addresses": [ + { + "email": "jane@example.com" + }, + { + "name": "John Smîth", + "email": "john@example.com" + } + ] + } + ], + "subject": "Why not both importing AND exporting? ☺", + "receivedAt": "2021-11-20T14:22:01-08:00", + "sentAt": "2021-11-20T14:22:01-08:00", + "messageId": [ + "my-message-id" + ], + "textBody": [ + { + "type": "text/plain", + "blobId": "I was thinking about quitting the “exporting” to focus just on the “importing”,\nbut then I thought, why not do both? ☺\n", + "header:Content-Language": "en" + } + ], + "htmlBody": [ + { + "type": "text/html", + "blobId": "

I was thinking about quitting the “exporting” to focus just on the “importing”,

but then I thought, why not do both? ☺

", + "header:Content-Language": "en_US" + } + ], + "attachments": [ + { + "type": "image/png", + "blobId": "here are the embedded image contents!", + "cid": "cid:1234-5678-9012-3456" + }, + { + "type": "x-document/pdf", + "blobId": "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!", + "disposition": "attachment", + "name": "Book about ☕ tables.pdf" + } + ] +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/nested_body.eml b/tests/resources/jmap_mail_set/nested_body.eml new file mode 100644 index 00000000..5d5b2b68 --- /dev/null +++ b/tests/resources/jmap_mail_set/nested_body.eml @@ -0,0 +1,98 @@ +Date: Tue, 10 Jul 2018 01:03:11 +0000 +From: "Joe Bloggs" +Message-ID: +Subject: RFC 8621 Section 4.1.4 test +Content-Type: multipart/mixed; + boundary="boundary_0" + + +--boundary_0 +Content-Disposition: inline +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Part A +--boundary_0 +Content-Type: multipart/mixed; + boundary="boundary_1" + + +--boundary_1 +Content-Type: multipart/alternative; + boundary="boundary_2" + + +--boundary_2 +Content-Type: multipart/mixed; + boundary="boundary_3" + + +--boundary_3 +Content-Disposition: inline +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Part B +--boundary_3 +Content-Disposition: inline +Content-Type: image/jpeg +Content-Transfer-Encoding: base64 + +UGFydCBD + +--boundary_3 +Content-Disposition: inline +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Part D +--boundary_3-- + +--boundary_2 +Content-Type: multipart/related; + boundary="boundary_4" + + +--boundary_4 +Content-Type: text/html +Content-Transfer-Encoding: 7bit + +Part E +--boundary_4 +Content-Type: image/jpeg +Content-Transfer-Encoding: base64 + +UGFydCBG + +--boundary_4-- + +--boundary_2-- + +--boundary_1 +Content-Disposition: attachment +Content-Type: image/jpeg +Content-Transfer-Encoding: base64 + +UGFydCBH + +--boundary_1 +Content-Type: application/x-excel +Content-Transfer-Encoding: base64 + +UGFydCBI + +--boundary_1 +Content-Type: x-message/rfc822 +Content-Transfer-Encoding: base64 + +UGFydCBK + +--boundary_1-- + +--boundary_0 +Content-Disposition: inline +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Part K +--boundary_0-- diff --git a/tests/resources/jmap_mail_set/nested_body.jmap b/tests/resources/jmap_mail_set/nested_body.jmap new file mode 100644 index 00000000..f3f8ffda --- /dev/null +++ b/tests/resources/jmap_mail_set/nested_body.jmap @@ -0,0 +1,592 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "$draft": true, + "$seen": true + }, + "receivedAt": "2018-07-10T01:03:11Z", + "messageId": [ + "my-message-id" + ], + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "subject": "RFC 8621 Section 4.1.4 test", + "sentAt": "2018-07-10T01:03:11Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "From", + "value": " \"Joe Bloggs\" " + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Subject", + "value": " RFC 8621 Section 4.1.4 test" + }, + { + "name": "Content-Type", + "value": " multipart/mixed; \r\n\tboundary=\"boundary_0\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/mixed; \r\n\tboundary=\"boundary_1\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/alternative; \r\n\tboundary=\"boundary_2\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/mixed; \r\n\tboundary=\"boundary_3\"" + } + ], + "type": "multipart/mixed", + "subParts": [ + { + "partId": "5", + "blobId": "blob_1", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "6", + "blobId": "blob_2", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg", + "disposition": "inline" + }, + { + "partId": "7", + "blobId": "blob_3", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ] + }, + { + "size": 0, + "headers": [ + { + "name": "Content-Type", + "value": " multipart/related; \r\n\tboundary=\"boundary_4\"" + } + ], + "type": "multipart/related", + "subParts": [ + { + "partId": "9", + "blobId": "blob_4", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " text/html" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "us-ascii" + }, + { + "partId": "10", + "blobId": "blob_5", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg" + } + ] + } + ] + }, + { + "partId": "11", + "blobId": "blob_6", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " attachment" + }, + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg", + "disposition": "attachment" + }, + { + "partId": "12", + "blobId": "blob_7", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " application/x-excel" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "application/x-excel" + }, + { + "partId": "13", + "blobId": "blob_8", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " x-message/rfc822" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "x-message/rfc822" + } + ] + }, + { + "partId": "14", + "blobId": "blob_9", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ] + }, + "bodyValues": { + "1": { + "value": "Part A", + "isEncodingProblem": false, + "isTruncated": false + }, + "14": { + "value": "Part K", + "isEncodingProblem": false, + "isTruncated": false + }, + "5": { + "value": "Part B", + "isEncodingProblem": false, + "isTruncated": false + }, + "6": { + "value": "Part C", + "isEncodingProblem": false, + "isTruncated": false + }, + "7": { + "value": "Part D", + "isEncodingProblem": false, + "isTruncated": false + }, + "9": { + "value": "Part E", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "5", + "blobId": "blob_1", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "6", + "blobId": "blob_2", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg", + "disposition": "inline" + }, + { + "partId": "7", + "blobId": "blob_3", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "14", + "blobId": "blob_9", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ], + "htmlBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + }, + { + "partId": "9", + "blobId": "blob_4", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " text/html" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "us-ascii" + }, + { + "partId": "14", + "blobId": "blob_9", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " text/plain" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "us-ascii", + "disposition": "inline" + } + ], + "attachments": [ + { + "partId": "6", + "blobId": "blob_2", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " inline" + }, + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg", + "disposition": "inline" + }, + { + "partId": "10", + "blobId": "blob_5", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg" + }, + { + "partId": "11", + "blobId": "blob_6", + "size": 6, + "headers": [ + { + "name": "Content-Disposition", + "value": " attachment" + }, + { + "name": "Content-Type", + "value": " image/jpeg" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "image/jpeg", + "disposition": "attachment" + }, + { + "partId": "12", + "blobId": "blob_7", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " application/x-excel" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "application/x-excel" + }, + { + "partId": "13", + "blobId": "blob_8", + "size": 6, + "headers": [ + { + "name": "Content-Type", + "value": " x-message/rfc822" + }, + { + "name": "Content-Transfer-Encoding", + "value": " base64" + } + ], + "type": "x-message/rfc822" + } + ], + "hasAttachment": true, + "preview": "Part A" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/nested_body.json b/tests/resources/jmap_mail_set/nested_body.json new file mode 100644 index 00000000..5ddc98d0 --- /dev/null +++ b/tests/resources/jmap_mail_set/nested_body.json @@ -0,0 +1,89 @@ +{ + "keywords": { + "$seen": true, + "$draft": true + }, + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "subject": "RFC 8621 Section 4.1.4 test", + "receivedAt": "2018-07-10T01:03:11Z", + "sentAt": "2018-07-10T11:03:11+10:00", + "messageId": [ + "my-message-id" + ], + "bodyStructure": { + "subParts": [ + { + "blobId": "Part A", + "disposition": "inline", + "type": "text/plain" + }, + { + "subParts": [ + { + "subParts": [ + { + "subParts": [ + { + "blobId": "Part B", + "disposition": "inline", + "type": "text/plain" + }, + { + "blobId": "Part C", + "disposition": "inline", + "type": "image/jpeg" + }, + { + "blobId": "Part D", + "disposition": "inline", + "type": "text/plain" + } + ], + "type": "multipart/mixed" + }, + { + "subParts": [ + { + "blobId": "Part E", + "type": "text/html" + }, + { + "blobId": "Part F", + "type": "image/jpeg" + } + ], + "type": "multipart/related" + } + ], + "type": "multipart/alternative" + }, + { + "blobId": "Part G", + "disposition": "attachment", + "type": "image/jpeg" + }, + { + "blobId": "Part H", + "type": "application/x-excel" + }, + { + "blobId": "Part J", + "type": "x-message/rfc822" + } + ], + "type": "multipart/mixed" + }, + { + "blobId": "Part K", + "disposition": "inline", + "type": "text/plain" + } + ], + "type": "multipart/mixed" + } +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/rfc8621_1.eml b/tests/resources/jmap_mail_set/rfc8621_1.eml new file mode 100644 index 00000000..bc05cf0a --- /dev/null +++ b/tests/resources/jmap_mail_set/rfc8621_1.eml @@ -0,0 +1,9 @@ +Date: Tue, 10 Jul 2018 01:03:11 +0000 +From: "Joe Bloggs" +Message-ID: +Subject: World domination +Content-Language: en +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 7bit + +I have the most brilliant plan. Let me tell you all about it. What we do is, we \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/rfc8621_1.jmap b/tests/resources/jmap_mail_set/rfc8621_1.jmap new file mode 100644 index 00000000..76d586f0 --- /dev/null +++ b/tests/resources/jmap_mail_set/rfc8621_1.jmap @@ -0,0 +1,155 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "$draft": true, + "$seen": true + }, + "receivedAt": "2018-07-10T01:03:11Z", + "messageId": [ + "my-message-id" + ], + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "subject": "World domination", + "sentAt": "2018-07-10T01:03:11Z", + "bodyStructure": { + "partId": "0", + "blobId": "blob_0", + "size": 81, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "From", + "value": " \"Joe Bloggs\" " + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Subject", + "value": " World domination" + }, + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8", + "language": [ + "en" + ] + }, + "bodyValues": { + "0": { + "value": "I have the most brilliant plan. Let me tell you all about it. What we do is, we", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "0", + "blobId": "blob_0", + "size": 81, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "From", + "value": " \"Joe Bloggs\" " + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Subject", + "value": " World domination" + }, + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8", + "language": [ + "en" + ] + } + ], + "htmlBody": [ + { + "partId": "0", + "blobId": "blob_0", + "size": 81, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:03:11 +0000" + }, + { + "name": "From", + "value": " \"Joe Bloggs\" " + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Subject", + "value": " World domination" + }, + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8", + "language": [ + "en" + ] + } + ], + "attachments": [], + "hasAttachment": false, + "preview": "I have the most brilliant plan. Let me tell you all about it. What we do is, we" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/rfc8621_1.json b/tests/resources/jmap_mail_set/rfc8621_1.json new file mode 100644 index 00000000..6ae384c6 --- /dev/null +++ b/tests/resources/jmap_mail_set/rfc8621_1.json @@ -0,0 +1,29 @@ +{ + "keywords": { + "$seen": true, + "$draft": true + }, + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "subject": "World domination", + "receivedAt": "2018-07-10T01:03:11Z", + "sentAt": "2018-07-10T11:03:11+10:00", + "messageId": [ + "my-message-id" + ], + "bodyStructure": { + "type": "text/plain", + "partId": "bd48", + "header:Content-Language": "en" + }, + "bodyValues": { + "bd48": { + "value": "I have the most brilliant plan. Let me tell you all about it. What we do is, we", + "isTruncated": false + } + } +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/rfc8621_2.eml b/tests/resources/jmap_mail_set/rfc8621_2.eml new file mode 100644 index 00000000..3df3066d --- /dev/null +++ b/tests/resources/jmap_mail_set/rfc8621_2.eml @@ -0,0 +1,22 @@ +Date: Tue, 10 Jul 2018 01:05:08 +0000 +From: "Joe Bloggs" +Message-ID: +Subject: World domination +To: "John" +Content-Type: multipart/alternative; + boundary="boundary_0" + + +--boundary_0 +Content-Language: en +Content-Type: text/html; charset="utf-8" +Content-Transfer-Encoding: 7bit + +
I have the most brilliant plan. Let me tell you all about it. What we do is, we
+--boundary_0 +Content-Language: en +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 7bit + +I have the most brilliant plan. Let me tell you all about it. What we do is, we +--boundary_0-- diff --git a/tests/resources/jmap_mail_set/rfc8621_2.jmap b/tests/resources/jmap_mail_set/rfc8621_2.jmap new file mode 100644 index 00000000..cd347662 --- /dev/null +++ b/tests/resources/jmap_mail_set/rfc8621_2.jmap @@ -0,0 +1,174 @@ +{ + "mailboxIds": { + "a": true + }, + "keywords": { + "$draft": true, + "$seen": true + }, + "receivedAt": "2018-07-10T01:05:08Z", + "messageId": [ + "my-message-id" + ], + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "to": [ + { + "name": "John", + "email": "john@example.com" + } + ], + "subject": "World domination", + "sentAt": "2018-07-10T01:05:08Z", + "bodyStructure": { + "size": 0, + "headers": [ + { + "name": "Date", + "value": " Tue, 10 Jul 2018 01:05:08 +0000" + }, + { + "name": "From", + "value": " \"Joe Bloggs\" " + }, + { + "name": "Message-ID", + "value": " " + }, + { + "name": "Subject", + "value": " World domination" + }, + { + "name": "To", + "value": " \"John\" " + }, + { + "name": "Content-Type", + "value": " multipart/alternative; \r\n\tboundary=\"boundary_0\"" + } + ], + "type": "multipart/alternative", + "subParts": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 218, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/html; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "utf-8", + "language": [ + "en" + ] + }, + { + "partId": "2", + "blobId": "blob_1", + "size": 81, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8", + "language": [ + "en" + ] + } + ] + }, + "bodyValues": { + "1": { + "value": "...", + "isEncodingProblem": false, + "isTruncated": true + }, + "2": { + "value": "I have the most brilliant plan. Let me tell you all about it. What we do is, we", + "isEncodingProblem": false, + "isTruncated": false + } + }, + "textBody": [ + { + "partId": "2", + "blobId": "blob_1", + "size": 81, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/plain; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/plain", + "charset": "utf-8", + "language": [ + "en" + ] + } + ], + "htmlBody": [ + { + "partId": "1", + "blobId": "blob_0", + "size": 218, + "headers": [ + { + "name": "Content-Language", + "value": " en" + }, + { + "name": "Content-Type", + "value": " text/html; charset=\"utf-8\"" + }, + { + "name": "Content-Transfer-Encoding", + "value": " 7bit" + } + ], + "type": "text/html", + "charset": "utf-8", + "language": [ + "en" + ] + } + ], + "attachments": [], + "hasAttachment": false, + "preview": "I have the most brilliant plan. Let me tell you all about it. What we do is, we" +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_set/rfc8621_2.json b/tests/resources/jmap_mail_set/rfc8621_2.json new file mode 100644 index 00000000..4171ed75 --- /dev/null +++ b/tests/resources/jmap_mail_set/rfc8621_2.json @@ -0,0 +1,49 @@ +{ + "keywords": { + "$seen": true, + "$draft": true + }, + "from": [ + { + "name": "Joe Bloggs", + "email": "joe@example.com" + } + ], + "to": [ + { + "name": "John", + "email": "john@example.com" + } + ], + "messageId": [ + "my-message-id" + ], + "subject": "World domination", + "receivedAt": "2018-07-10T01:05:08Z", + "sentAt": "2018-07-10T11:05:08+10:00", + "bodyStructure": { + "type": "multipart/alternative", + "subParts": [ + { + "partId": "a49d", + "type": "text/html", + "header:Content-Language": "en" + }, + { + "partId": "bd48", + "type": "text/plain", + "header:Content-Language": "en" + } + ] + }, + "bodyValues": { + "bd48": { + "value": "I have the most brilliant plan. Let me tell you all about it. What we do is, we", + "isTruncated": false + }, + "a49d": { + "value": "
I have the most brilliant plan. Let me tell you all about it. What we do is, we
", + "isTruncated": false + } + } +} \ No newline at end of file diff --git a/tests/resources/jmap_mail_snippet/html.eml b/tests/resources/jmap_mail_snippet/html.eml new file mode 100644 index 00000000..9eb363fc --- /dev/null +++ b/tests/resources/jmap_mail_snippet/html.eml @@ -0,0 +1,35 @@ +Message-Id: <4.2.0.58.20000519003052.00a89c40@pop.example.com> +X-Sender: dwsauder@pop.example.com (Unverified) +X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 +X-Priority: 2 (High) +Date: Fri, 19 May 2000 00:31:00 -0400 +To: Heinz =?iso-8859-1?Q?M=FCller?= +From: Doug Sauder +Subject: =?iso-8859-1?Q?Die_Hasen_und_die_Fr=F6sche?= +Mime-Version: 1.0 +Content-Type: text/html; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + +Die Hasen und = +die +Fr=F6sche
+
+
Die Hasen klagten einst =FCber +ihre mi=DFliche Lage; "wir leben", sprach ein Redner, "in +steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler, +ja fast aller Raubtiere! Unsere stete Angst ist =E4rger als der Tod selbst. +Auf, la=DFt uns ein f=FCr allemal sterben."
+
+In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu; +allein das au=DFerordentliche Get=F6se und ihre wunderbare Gestalt +erschreckte eine Menge Fr=F6sche, die am Ufer sa=DFen, so sehr, da=DF sie au= +fs +schnellste untertauchten.
+
+"Halt", rief nun eben dieser Sprecher, "wir wollen das +Ers=E4ufen noch ein wenig aufschieben, denn auch uns f=FCrchten, wie ihr +seht, einige Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als +wir."
+
+
diff --git a/tests/resources/jmap_mail_snippet/mixed.eml b/tests/resources/jmap_mail_snippet/mixed.eml new file mode 100644 index 00000000..220b79b8 --- /dev/null +++ b/tests/resources/jmap_mail_snippet/mixed.eml @@ -0,0 +1,77 @@ +MIME-Version: 1.0 +Date: Sat, 13 Aug 2021 15:51:01 +0200 +Message-ID: +Subject: Biblioteca de Babel +From: Jorge Luis Borges +To: Julio Cortázar +Content-Language: es +Content-Type: multipart/alternative; boundary="0000000000006adf7205e61fb0a1" + +--0000000000006adf7205e61fb0a1 +Content-Type: text/plain; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +El universo (que otros llaman la *Biblioteca*) se compone de un n=C3=BAmero +indefinido, y +tal vez infinito, de galer=C3=ADas hexagonales, con vastos pozos de ventila= +ci=C3=B3n +en el medio, +cercados por barandas baj=C3=ADsimas. Desde cualquier hex=C3=A1gono se ven = +los pisos +inferiores y +superiores: interminablemente. La distribuci=C3=B3n de las galer=C3=ADas es +invariable. Veinte +anaqueles, a cinco largos anaqueles por lado, cubren todos los lados menos +dos; su altura, +que es la de los pisos, excede apenas la de un bibliotecario normal. Una de +las caras libres +da a un angosto zagu=C3=A1n, que desemboca en otra galer=C3=ADa, id=C3=A9nt= +ica a la +primera y a todas. A +izquierda y a derecha del zagu=C3=A1n hay dos gabinetes min=C3=BAsculos. Un= +o permite +dormir de +pie; otro, satisfacer las necesidades finales. Por ah=C3=AD pasa la escaler= +a +espiral, que se abisma +y se eleva hacia lo remoto. En el zagu=C3=A1n hay un espejo, que fielmente +duplica las +apariencias. Los hombres suelen inferir de ese espejo que la *Biblioteca* +no es infinita (si +lo fuera realmente =C2=BFa qu=C3=A9 esa duplicaci=C3=B3n ilusoria?); yo pre= +fiero so=C3=B1ar que +las superficies +bru=C3=B1idas figuran y prometen el infinito... La luz procede de unas frut= +as +esf=C3=A9ricas que +llevan el nombre de l=C3=A1mparas. Hay dos en cada hex=C3=A1gono: transvers= +ales. La +luz que +emiten es insuficiente, incesante. + +--0000000000006adf7205e61fb0a1 +Content-Type: text/html; charset="UTF-8" +Content-Transfer-Encoding: quoted-printable + +
El universo (que otros llaman la Biblioteca) se com= +pone de un n=C3=BAmero indefinido, y
tal vez infinito, de galer=C3=ADas = +hexagonales, con vastos pozos de ventilaci=C3=B3n en el medio,
cercados = +por barandas baj=C3=ADsimas. Desde cualquier hex=C3=A1gono se ven los pisos= + inferiores y
superiores: interminablemente. La distribuci=C3=B3n de las= + galer=C3=ADas es invariable. Veinte
anaqueles, a cinco largos anaqueles= + por lado, cubren todos los lados menos dos; su altura,
que es la de los= + pisos, excede apenas la de un bibliotecario normal. Una de las caras libre= +s
da a un angosto zagu=C3=A1n, que desemboca en otra galer=C3=ADa, id=C3= +=A9ntica a la primera y a todas. A
izquierda y a derecha del zagu=C3=A1n= + hay dos gabinetes min=C3=BAsculos. Uno permite dormir de
pie; otro, sat= +isfacer las necesidades finales. Por ah=C3=AD pasa la escalera espiral, que= + se abisma
y se eleva hacia lo remoto. En el zagu=C3=A1n hay un espejo, = +que fielmente duplica las
apariencias. Los hombres suelen inferir de ese= + espejo que la Biblioteca no es infinita (si
lo fuera realmente = +=C2=BFa qu=C3=A9 esa duplicaci=C3=B3n ilusoria?); yo prefiero so=C3=B1ar qu= +e las superficies
bru=C3=B1idas figuran y prometen el infinito... La luz= + procede de unas frutas esf=C3=A9ricas que
llevan el nombre de l=C3=A1mp= +aras. Hay dos en cada hex=C3=A1gono: transversales. La luz que
emit= +en es insuficiente, incesante.

+ +--0000000000006adf7205e61fb0a1-- diff --git a/tests/resources/jmap_mail_snippet/subpart.eml b/tests/resources/jmap_mail_snippet/subpart.eml new file mode 100644 index 00000000..042e0623 --- /dev/null +++ b/tests/resources/jmap_mail_snippet/subpart.eml @@ -0,0 +1,72 @@ +From: Al Gore +To: White House Transportation Coordinator + +Subject: [Fwd: Map of Argentina with Description] +Content-Type: multipart/mixed; + boundary="D7F------------D7FD5A0B8AB9C65CCDBFA872" + +This is a multi-part message in MIME format. +--D7F------------D7FD5A0B8AB9C65CCDBFA872 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit + +Fred, + +Fire up Air Force One! We're going South! + +Thanks, +Al +--D7F------------D7FD5A0B8AB9C65CCDBFA872 +Content-Type: message/rfc822 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Return-Path: +Received: from mailhost.whitehouse.gov ([192.168.51.200]) + by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453 + for ; + Mon, 13 Aug 1998 l8:14:23 +1000 +Received: from the_big_box.whitehouse.gov ([192.168.51.50]) + by mailhost.whitehouse.gov (8.8.8/8.8.7) with ESMTP id RAA20366 + for vice-president@whitehouse.gov; Mon, 13 Aug 1998 17:42:41 +1000 +Date: Mon, 13 Aug 1998 17:42:41 +1000 +Message-Id: <199804130742.RAA20366@mai1host.whitehouse.gov> +From: Bill Clinton +To: A1 (The Enforcer) Gore +Subject: Map of Argentina with Description +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="DC8------------DC8638F443D87A7F0726DEF7" + +This is a multi-part message in MIME format. +--DC8------------DC8638F443D87A7F0726DEF7 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit + +Hi A1, + +I finally figured out this MIME thing. Pretty cool. I'll send you +some sax music in .au files next week! + +Anyway, the attached image is really too small to get a good look at +Argentina. Try this for a much better map: + + http://www.1one1yp1anet.com/dest/sam/graphics/map-arg.htm + +Then again, shouldn't the CIA have something like that? + +Bill +--DC8------------DC8638F443D87A7F0726DEF7 +Content-Type: image/gif; name="map_of_Argentina.gif" +Content-Transfer-Encoding: base64 +Content-Disposition: inline; fi1ename="map_of_Argentina.gif" + +R01GOD1hJQA1AKIAAP/////78P/omn19fQAAAAAAAAAAAAAAACwAAAAAJQA1AAAD7Qi63P5w +wEmjBCLrnQnhYCgM1wh+pkgqqeC9XrutmBm7hAK3tP31gFcAiFKVQrGFR6kscnonTe7FAAad +GugmRu3CmiBt57fsVq3Y0VFKnpYdxPC6M7Ze4crnnHum4oN6LFJ1bn5NXTN7OF5fQkN5WYow +BEN2dkGQGWJtSzqGTICJgnQuTJN/WJsojad9qXMuhIWdjXKjY4tenjo6tjVssk2gaWq3uGNX +U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz +7itICBxISKDBgwgTKjyYAAA7 +--DC8------------DC8638F443D87A7F0726DEF7-- + +--D7F------------D7FD5A0B8AB9C65CCDBFA872-- diff --git a/tests/resources/jmap_mail_snippet/text_plain.eml b/tests/resources/jmap_mail_snippet/text_plain.eml new file mode 100644 index 00000000..ac9652b9 --- /dev/null +++ b/tests/resources/jmap_mail_snippet/text_plain.eml @@ -0,0 +1,19 @@ +From: Abidjan Prince +To: Bill Foobar +Subject: Help a friend from Abidjan Côte d'Ivoire + +When my mother died when she was given birth to me, my father took me so +special because I am motherless. Before the death of my late father on 22nd June +2013 in a private hospital here in Abidjan Côte d'Ivoire. He secretly called me on his +bedside and told me that he has a sum of $7.5M (Seven Million five Hundred +Thousand Dollars) left in a suspense account in a local bank here in Abidjan Côte +d'Ivoire, that he used my name as his only daughter for the next of kin in deposit of +the fund. +I am 24year old. Dear I am honorably seeking your assistance in the following ways. +1) To provide any bank account where this money would be transferred into. +2) To serve as the guardian of this fund. +3) To make arrangement for me to come over to your country to further my +education and to secure a residential permit for me in your country. +Moreover, I am willing to offer you 30 percent of the total sum as compensation for +your effort input after the successful transfer of this fund to your nominated +account overseas. diff --git a/tests/resources/jmap_mail_snippet/text_plain_chinese.eml b/tests/resources/jmap_mail_snippet/text_plain_chinese.eml new file mode 100644 index 00000000..54dd5dd8 --- /dev/null +++ b/tests/resources/jmap_mail_snippet/text_plain_chinese.eml @@ -0,0 +1,17 @@ +From: "孫子" +To: "Bill Foobar" +Subject: 孫子兵法 + +<"孫子兵法:"> +孫子曰:兵者,國之大事,死生之地,存亡之道,不可不察也。 +孫子曰:凡用兵之法,馳車千駟,革車千乘,帶甲十萬;千里饋糧,則內外之費賓客之用,膠漆之材, +車甲之奉,日費千金,然後十萬之師舉矣。 +孫子曰:凡用兵之法,全國為上,破國次之;全旅為上,破旅次之;全卒為上,破卒次之;全伍為上,破伍次之。 +是故百戰百勝,非善之善者也;不戰而屈人之兵,善之善者也。 +孫子曰:昔之善戰者,先為不可勝,以待敵之可勝,不可勝在己,可勝在敵。故善戰者,能為不可勝,不能使敵必可勝。 +故曰:勝可知,而不可為。 +兵者,詭道也。故能而示之不能,用而示之不用,近而示之遠,遠而示之近。利而誘之,亂而取之,實而備之,強而避之, +怒而撓之,卑而驕之,佚而勞之,親而離之。攻其無備,出其不意,此兵家之勝,不可先傳也。 +夫未戰而廟算勝者,得算多也;未戰而廟算不勝者,得算少也;多算勝,少算不勝,而況於無算乎?吾以此觀之,勝負見矣。 +孫子曰:凡治眾如治寡,分數是也。鬥眾如鬥寡,形名是也。三軍之眾,可使必受敵而無敗者,奇正是也。兵之所加, +如以碬投卵者,虛實是也。 diff --git a/tests/resources/jmap_sieve/test_discard_reject.sieve b/tests/resources/jmap_sieve/test_discard_reject.sieve new file mode 100644 index 00000000..bc3cb213 --- /dev/null +++ b/tests/resources/jmap_sieve/test_discard_reject.sieve @@ -0,0 +1,41 @@ +require ["duplicate", "ihave", "reject", "body"]; + +if body :contains "TPS" { + if duplicate :handle "one_sec_expire" :seconds 1 { + error "one_sec_expire handle should not be duplicate."; + } + + if duplicate :uniqueid "one_sec_expire" :seconds 1 { + error "one_sec_expire uniqueid should not be duplicate."; + } + + if duplicate :handle "five_secs_expire" :seconds 5 { + error "five_secs_expire handle should not be duplicate."; + } + + if duplicate :uniqueid "five_secs_expire" :seconds 5 { + error "five_secs_expire uniqueid should not be duplicate."; + } + + discard; +} elsif body :contains "T.P.S." { + if duplicate :handle "one_sec_expire" :seconds 1 { + error "one_sec_expire handle should have expired."; + } + + if duplicate :uniqueid "one_sec_expire" :seconds 1 { + error "one_sec_expire uniqueid should have expired."; + } + + if not duplicate :handle "five_secs_expire" :seconds 5 { + error "five_secs_expire handle should be duplicate."; + } + + if not duplicate :uniqueid "five_secs_expire" :seconds 5 { + error "five_secs_expire uniqueid should be duplicate."; + } + + reject "No soup for you, next!"; +} else { + error "Unexpected body contents."; +} diff --git a/tests/resources/jmap_sieve/test_include.sieve b/tests/resources/jmap_sieve/test_include.sieve new file mode 100644 index 00000000..c92dbe2a --- /dev/null +++ b/tests/resources/jmap_sieve/test_include.sieve @@ -0,0 +1,5 @@ +require ["include", "ihave"]; + +include "test_include_this"; + +error "'stop' within included script ignored or include failed."; diff --git a/tests/resources/jmap_sieve/test_include_this.sieve b/tests/resources/jmap_sieve/test_include_this.sieve new file mode 100644 index 00000000..d0d73c7c --- /dev/null +++ b/tests/resources/jmap_sieve/test_include_this.sieve @@ -0,0 +1,4 @@ +require "reject"; + +reject "Rejected from an included script."; +stop; diff --git a/tests/resources/jmap_sieve/test_mailbox.sieve b/tests/resources/jmap_sieve/test_mailbox.sieve new file mode 100644 index 00000000..590c0db0 --- /dev/null +++ b/tests/resources/jmap_sieve/test_mailbox.sieve @@ -0,0 +1,63 @@ +require ["fileinto", "mailbox", "mailboxid", "special-use", "ihave", "imap4flags"]; + +# SpecialUse extension tests +if not specialuse_exists ["inbox", "trash"] { + error "Special-use mailboxes INBOX or TRASH do not exist."; +} + +if not anyof(specialuse_exists "Inbox" "inbox", + specialuse_exists "Deleted Items" "trash") { + error "Special-use mailboxes INBOX or TRASH do not exist."; +} + +if specialuse_exists "dingleberry" { + error "An invalid special-use exists."; +} + +if specialuse_exists "archive" { + error "A non-existant special-use exists."; +} + +# MailboxId tests +if not mailboxidexists "a" { + error "Inbox not found by mailboxid."; +} + +if not mailboxidexists ["a", "b"] { + error "Inbox and Trash mailboxes not found by mailboxid."; +} + +# MailboxExists tests +if not mailboxexists "Inbox" { + error "Inbox not found by name."; +} + +if not mailboxexists ["Drafts", "Sent Items"] { + error "Drafts and Sent Items not found by name."; +} + +# File into new mailboxes using flags +fileinto :create "Inbox / Folder "; +fileinto :flags ["$important", "$seen"] :create "My/Nested/Mailbox/with/multiple/levels"; + +# Make sure all mailboxes were created +if not mailboxexists "Inbox/Folder" { + error "'Inbox/Folder' not found."; +} + +if not mailboxexists "My/Nested/Mailbox/with/multiple/levels" { + error "'My/Nested/Mailbox/with/multiple/levels' not found."; +} + +if not mailboxexists "My/Nested/Mailbox/with/multiple" { + error "'My/Nested/Mailbox/with/multiple' not found."; +} + +if not mailboxexists "My/Nested" { + error "'My/Nested' not found."; +} + +if not mailboxexists "My" { + error "'My' not found."; +} + diff --git a/tests/resources/jmap_sieve/test_notify_fcc.sieve b/tests/resources/jmap_sieve/test_notify_fcc.sieve new file mode 100644 index 00000000..905c1d88 --- /dev/null +++ b/tests/resources/jmap_sieve/test_notify_fcc.sieve @@ -0,0 +1,13 @@ +require ["enotify", "fcc", "mailbox", "editheader", "imap4flags"]; + +if header :matches "Subject" "*TPS*" { + notify :message "It's time to file your TPS report." + :fcc "Notifications" :create + "mailto:sms_gateway@example.com?subject=It's%20TPS-o-clock"; + + deleteheader "Subject"; + addheader "Subject" "${1}**censored**${2}"; + setflag "$seen"; +} + +keep; diff --git a/tests/resources/jmap_sieve/test_redirect_enclose.sieve b/tests/resources/jmap_sieve/test_redirect_enclose.sieve new file mode 100644 index 00000000..4a8726b2 --- /dev/null +++ b/tests/resources/jmap_sieve/test_redirect_enclose.sieve @@ -0,0 +1,5 @@ +require ["enclose"]; + +enclose :subject "Check this out" "Attached you'll find a message I just received."; +redirect "jane@example.com"; +discard; diff --git a/tests/resources/jmap_sieve/validate_error.sieve b/tests/resources/jmap_sieve/validate_error.sieve new file mode 100644 index 00000000..0d6507c4 --- /dev/null +++ b/tests/resources/jmap_sieve/validate_error.sieve @@ -0,0 +1 @@ +keep :invalidtag; diff --git a/tests/resources/jmap_sieve/validate_ok.sieve b/tests/resources/jmap_sieve/validate_ok.sieve new file mode 100644 index 00000000..e458933f --- /dev/null +++ b/tests/resources/jmap_sieve/validate_ok.sieve @@ -0,0 +1,3 @@ +if true { + keep; +} diff --git a/tests/resources/tls_cert.pem b/tests/resources/tls_cert.pem new file mode 100644 index 00000000..02b9b963 --- /dev/null +++ b/tests/resources/tls_cert.pem @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIFCTCCAvGgAwIBAgIUCgHGQYUqtelbHGVSzCVwBL3fyEUwDQYJKoZIhvcNAQEL +BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIyMDUxNjExNDAzNFoXDTIzMDUx +NjExNDAzNFowFDESMBAGA1UEAwwJbG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEAtwS0Fzl3SjaCuKEXgZ/fdWbDoj/qDphyNCAKNevQ0+D0 +STNkWCO04aFSH0zcL8zoD9gokNos0i7OU9//ZhZQmex4V6EFdZn8bFwUWN/scUvW +HEFXVjtHldO2isZgIxH9LuwRv7KAgkISuWahqerOVDhe7SeQUV0AJGNEh3cT9PZr +gSY931BxB7n+5k8eoSk8Z1gtBzQzL62kVGpHDKfw8yX8m65owF9eLUBrNzgxmXfC +xpuHwj7hmVhS09PPKeN/RsFS8PsYO7bo0u8jEKalteumjRT7RyUEbioqfo6ZFOGj +FHPIq/uKXS9zN1fpoyNh3ur5hMznQhrqlwBM9KlM7GdBJ0pZ3ad0YjT8IL/GnGKR +85J2WZdLqaQdUZo7nV67FhqdDlNE4MdwiykTMjfmLRXGAVhAzJHKyRKNwmkI2aqe +S7aqeNgvuDBwY80Q9a2rb5py1Aw+L8yCkUBuHboToDpxSVRDNN8DrWNmmsXnxsOG +wRDODy4GICKyxlP+RFSM8xWSQ6y9ktS2OfDBm+Eqcw+3pZKhdz2wgxLkUBJ8X1eh +kJrCA/6LTuhy6m6mMjAfoSOFU7fu88jxaWPgvP7GKyH+LM/t9eucobz2ks5rtSjz +V4Dc5DCS94/OpVRHwHdaFSPbJKBN9Ev8gnNrAyx/aBPGoHBPG/QUiU7dcUNIPt0C +AwEAAaNTMFEwHQYDVR0OBBYEFI167IxBmErB11EqiPPqFLa31ZaMMB8GA1UdIwQY +MBaAFI167IxBmErB11EqiPPqFLa31ZaMMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI +hvcNAQELBQADggIBALU00IOiH5ubEauVCmakms5ermNTZfculnhnDfWTLMeh2+a7 +G4cqADErfMhm/mmLbrw33t9s6tCAhQltvewKR40ST9uMPSyiQbYaCXd5DXnuI6Ox +JtNW+UOWIaMf8abnkdLvREOvb8dVQS1i3xq14tAjY5XgpGwCPP8m54b7N3Q7soLn +e5PDhPNTnhRIn2RLuYoZmQmMA5fcqEUDYff4epUww7PhrM1QckZligI3566NlGOf +j1G9JrivBtY0eaJtamIFnGMBT0ThDudxVja2Nv0C2Elry0p4T/o4nc4M67BJ/y1R +vjNLAgFhbxssemU3lZqSd+pykpJBwDBjFSPrZZmQcbk7H6Uz8V1xr/xuzfw6fA13 +NWZ5vLgP/DQ13sM+XFlxThKfbPMPVe/UCTvfGtNW+3XyBgPntEkR+fNEawQmzbYl +R+X1ymT9MZnEZqRMf7/UD/SYek1aUJefoew3upjMgxYVvh4F8dqJ+39F+xoFzIA2 +1dDAEMzXtjA3zKhZ2cycZbEzpJvYA3eGLuR16Suqfi4kPvfwK0mOhCxQmpayt7/X +vuEzW6dPCH8Hgbb0WvsSppGOvhdbDaZFNfFc5eNSxhyKzu3H3ACNImZRtZE+yixx +0fR8+xz9kDLf8xupV+X9heyFGHSyYU2Lveaevtr2Ij3weLRgJ6LbNALoeKXk +-----END CERTIFICATE----- diff --git a/tests/resources/tls_privatekey.pem b/tests/resources/tls_privatekey.pem new file mode 100644 index 00000000..3f9ff47f --- /dev/null +++ b/tests/resources/tls_privatekey.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQC3BLQXOXdKNoK4 +oReBn991ZsOiP+oOmHI0IAo169DT4PRJM2RYI7ThoVIfTNwvzOgP2CiQ2izSLs5T +3/9mFlCZ7HhXoQV1mfxsXBRY3+xxS9YcQVdWO0eV07aKxmAjEf0u7BG/soCCQhK5 +ZqGp6s5UOF7tJ5BRXQAkY0SHdxP09muBJj3fUHEHuf7mTx6hKTxnWC0HNDMvraRU +akcMp/DzJfybrmjAX14tQGs3ODGZd8LGm4fCPuGZWFLT088p439GwVLw+xg7tujS +7yMQpqW166aNFPtHJQRuKip+jpkU4aMUc8ir+4pdL3M3V+mjI2He6vmEzOdCGuqX +AEz0qUzsZ0EnSlndp3RiNPwgv8acYpHzknZZl0uppB1RmjudXrsWGp0OU0Tgx3CL +KRMyN+YtFcYBWEDMkcrJEo3CaQjZqp5Ltqp42C+4MHBjzRD1ratvmnLUDD4vzIKR +QG4duhOgOnFJVEM03wOtY2aaxefGw4bBEM4PLgYgIrLGU/5EVIzzFZJDrL2S1LY5 +8MGb4SpzD7elkqF3PbCDEuRQEnxfV6GQmsID/otO6HLqbqYyMB+hI4VTt+7zyPFp +Y+C8/sYrIf4sz+3165yhvPaSzmu1KPNXgNzkMJL3j86lVEfAd1oVI9skoE30S/yC +c2sDLH9oE8agcE8b9BSJTt1xQ0g+3QIDAQABAoICABq5oxqpF5RMtXYEgAw7rkPU +h8jPkHwlIrgd3Z/WGZ53APUXfhWo0ScJiZZsgNKyF0kJBZNxaI4gq5xv3zmnFIoF +j+Ur7EIqBERGheoceMhqjI9/syMycNeeHM/S/ALjA5ewfT8C7+UVhOpx5DWNxidi +O+phlp9q9zRZEo69grqIqVYooWxUsMyyCljTQOPDw8BLjfe5VagmsRJqmolslLDM +4UBSjZVZ18S/3Wgo2oVQia660244BHWCAkZQbbXuNI2+eUAbSoSdxw3WQcaSrywL +hzyezbqr2yPDIIVuiUgVUt0Ps0P57VCCN07jlYhvCEGnClysFzD+ATefoZ0wg7za +dQu2E+d166rAjnssyhzcHMn3pxgSdtXD+dQR/xfIGbPABucCupEFqKmhLdMm9+ud +lHay87qzMpIa8cITJwEQROfXqWAhNUU98pKCOx1SVXBqQC7QVqGQ5solDf0eMSVh +ngQ6Dz2WUI2ty75LteiFwlyTgnU9nyPN0NXsrMEET2BHWre7ufTQqiULtQ7+9BwH +AMxEKvrQHjMUjdfbXuzdyc5w5mPYJZfFVSQ1HMslx66h9yCpRIsBZvUGvoaP8Tpe +nQ66FTYRbiOkkdJ7k8DtrnhsJI1oOGjnvj/rvZ8D2pvrlJcIH2AyN3MOL8Jp5Oj1 +nCFt77TwpF92pgl0g9gBAoIBAQDcarmP54QboaIQ9S2gE/4gSVC5i44iDJuSRdI8 +K081RQcWiNzqQXTRc5nqJ7KzLyPiGlg+6rWsBKLos5l4t+MdhhH+KUvk/OtT/g8V +0NZBNXLIbSb8j8ix4v3/f2qKHN3Co6QOlxb3gFvobKDdoKqUNiSH1zTZ8/Y/BzkM +jqWKhTdaLz6eyzhKfOTA4LO8kJ3VF8HUM1N9/e8Gjorl+gZpJUXUQS0+AIi8W76C +OwDrVb3BPGVnApQJfWF78h4g20RwXrx/GYUW2vOMcLjXXDV5U7+nobPUoJnLxoZC +16o88y0Ivan8dBNXsc1epyPvvEqp6MJbAyyVuNeuRJcgYA0BAoIBAQDUkGRV7fLG +wCr5rNysUO+FKzVtTJnf9KEsqAqUmmVnG4oubxAJJtiB5n2+DT+CtO8Nrtz05BbR +uxfWm+lbEw6lVMj63bywtp0NdULg7/2t+oq2Svv16KrZIRJttXMkdEiFFmkVAEhX +l8Fyl6PJPfSMwbPdXEUPUAaNrXweVFffXczHc4W2G212ZzDB0z7QQSgEntbTDFB/ +2Cg5dvuojlM9zw0fuEyLwItZs7n16j/ONZLgBHyroMU9ZPxbnLrVyoZlqtob+RWm +Ju2fSIL9QqG6O4td1TqcUBGvFQYjGvKA+q5fsG26NBJ0Ac48cNK6PS4lMkN3Av2J +ccloYaMEHAXdAoIBAE8WMCy1Ok6byUXiYxOL+OPmyoM40q/e7DcovE2AkLQhZ3Cr +fPDEucCphPFiexkV8f8fysgQeU0WgMmUH54UBPbD81LJyISKR3nkr875Ftdg8SV/ +HL0EblN9ifuR4U1bHCrJgoUFq2T09oVH7NR44Ju7bZIcIseNZK6qzcp2qGkycXD3 +gLWDX1hCxeV6+qLPFQKvuomEPRH4+jnVDXuFIaW6jPqixDP6BxXmqU2bFDJcmnBq +VkwGvc1F4qORdUP+yOi05VeJdZqEx1x92aTUXg+BgEQKnjbNxUE7o1L6hQfHjUIU +o5iEoagWkQTEXf2YBwY+EPaNBgNWxnSuAbfJHwECggEBALOF95ezTVWauzD/U6ic ++o3n/kl/Zn4FJ5KFodn7xCSe18d7uXlhO34KYqx+l+MWWMefpbGWacdcUjfImf93 +SulLgCqP12sP7/iLzp4XUpL7hOeM0NvRU2nqSpwpoUNqik0Mrlc0U+TWoGTduVCf +aMjwV65e3VyfY8mIeclLxqM5n1fcM1OoOnzDjiRE+0n7nYa5eAnq3pn6v4449TZY +belH03e0ucFWLtrltesBmj3YdWGJqJlzQOInRhNBfXJOh8+ZynfRmP0o54udPDQV +cG3PGFd5XPTjkuvhv7sqaSGRlm/um92lWOhtFfdp+i+cuDpmByCef+7zEP19aKZx +3GkCggEAFTs7KNMfvIEaLH0yQUFeq2gLmtcMofmOmeoIECycN1rG7iJo07lJLIs0 +bVODH8Z0kX8llu3cjGMAH/6R2uugJSxkmFiZKrngTzKmxDPvTCKWR4RFwXH9j8IO +cPq7FtKN4SgrPy9ciAPdkcGmu3zz/sBKOaoPwvU2PdBRT+v/aoz+GCLXAvzFlKVe +9/7zdg87ilo8+AtV+71EJeR3kyBPKS9JrWYUKfiams12+uuH4/53rMFZfNCAaZ3Z +1sdXEO4o3Loc5TX4DbO9FVdBSBe6klEXx4T0QJboO6uBvTBnnRL2SQriJQQFwYT6 +XzVV5pwOxkIDBWDIqMUfwJDChBKfpw== +-----END PRIVATE KEY----- diff --git a/tests/src/jmap/email_get.rs b/tests/src/jmap/email_get.rs new file mode 100644 index 00000000..83196611 --- /dev/null +++ b/tests/src/jmap/email_get.rs @@ -0,0 +1,353 @@ +/* + * Copyright (c) 2020-2022, Stalwart Labs Ltd. + * + * This file is part of the Stalwart JMAP Server. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * in the LICENSE file at the top-level directory of this distribution. + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * You can be released from the requirements of the AGPLv3 license by + * purchasing a commercial license. Please contact licensing@stalw.art + * for more details. +*/ + +use std::{fs, path::PathBuf, sync::Arc}; + +use jmap::JMAP; +use jmap_client::{ + client::Client, + email::{self, Header, HeaderForm}, + mailbox::Role, +}; +use jmap_proto::types::id::Id; +use mail_parser::{HeaderName, RfcHeader}; + +use crate::jmap::replace_blob_ids; + +pub async fn test(server: Arc, client: &mut Client) { + println!("Running Email Get tests..."); + + let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + test_dir.push("resources"); + test_dir.push("jmap_mail_get"); + + let coco1 = "implement"; + let mailbox_id = "a".to_string(); + /*let mailbox_id = client + .set_default_account_id(Id::new(1).to_string()) + .mailbox_create("JMAP Get", None::, Role::None) + .await + .unwrap() + .take_id();*/ + + for file_name in fs::read_dir(&test_dir).unwrap() { + let mut file_name = file_name.as_ref().unwrap().path(); + if file_name.extension().map_or(true, |e| e != "eml") { + continue; + } + let is_headers_test = file_name.file_name().unwrap() == "headers.eml"; + + let blob = fs::read(&file_name).unwrap(); + let blob_len = blob.len(); + let email = client + .email_import( + blob, + [mailbox_id.clone()], + ["tag".to_string()].into(), + ((blob_len * 1000000) as i64).into(), + ) + .await + .unwrap(); + + let mut request = client.build(); + request + .get_email() + .ids([email.id().unwrap()]) + .properties([ + email::Property::Id, + email::Property::BlobId, + email::Property::ThreadId, + email::Property::MailboxIds, + email::Property::Keywords, + email::Property::Size, + email::Property::ReceivedAt, + email::Property::MessageId, + email::Property::InReplyTo, + email::Property::References, + email::Property::Sender, + email::Property::From, + email::Property::To, + email::Property::Cc, + email::Property::Bcc, + email::Property::ReplyTo, + email::Property::Subject, + email::Property::SentAt, + email::Property::HasAttachment, + email::Property::Preview, + email::Property::BodyValues, + email::Property::TextBody, + email::Property::HtmlBody, + email::Property::Attachments, + email::Property::BodyStructure, + ]) + .arguments() + .body_properties(if !is_headers_test { + [ + email::BodyProperty::PartId, + email::BodyProperty::BlobId, + email::BodyProperty::Size, + email::BodyProperty::Name, + email::BodyProperty::Type, + email::BodyProperty::Charset, + email::BodyProperty::Headers, + email::BodyProperty::Disposition, + email::BodyProperty::Cid, + email::BodyProperty::Language, + email::BodyProperty::Location, + ] + } else { + [ + email::BodyProperty::PartId, + email::BodyProperty::Size, + email::BodyProperty::Name, + email::BodyProperty::Type, + email::BodyProperty::Charset, + email::BodyProperty::Disposition, + email::BodyProperty::Cid, + email::BodyProperty::Language, + email::BodyProperty::Location, + email::BodyProperty::Header(Header { + name: "X-Custom-Header".into(), + form: HeaderForm::Raw, + all: false, + }), + email::BodyProperty::Header(Header { + name: "X-Custom-Header-2".into(), + form: HeaderForm::Raw, + all: false, + }), + ] + }) + .fetch_all_body_values(true) + .max_body_value_bytes(100); + + let mut result = request + .send_get_email() + .await + .unwrap() + .take_list() + .pop() + .unwrap() + .into_test(); + + if is_headers_test { + for property in all_headers() { + let mut request = client.build(); + request + .get_email() + .ids([email.id().unwrap()]) + .properties([property]); + result.headers.extend( + request + .send_get_email() + .await + .unwrap() + .take_list() + .pop() + .unwrap() + .into_test() + .headers, + ); + } + } + + let result = replace_blob_ids(serde_json::to_string_pretty(&result).unwrap()); + + file_name.set_extension("json"); + + if fs::read(&file_name).unwrap() != result.as_bytes() { + file_name.set_extension("failed"); + fs::write(&file_name, result.as_bytes()).unwrap(); + panic!("Test failed, output saved to {}", file_name.display()); + } + } + + let coco = "implement"; + //client.mailbox_destroy(&mailbox_id, true).await.unwrap(); + + //server.store.assert_is_empty(); +} + +pub fn all_headers() -> Vec { + let mut properties = Vec::new(); + + for header in [ + HeaderName::Rfc(RfcHeader::From), + HeaderName::Rfc(RfcHeader::To), + HeaderName::Rfc(RfcHeader::Cc), + HeaderName::Rfc(RfcHeader::Bcc), + HeaderName::Other("X-Address-Single".into()), + HeaderName::Other("X-Address".into()), + HeaderName::Other("X-AddressList-Single".into()), + HeaderName::Other("X-AddressList".into()), + HeaderName::Other("X-AddressesGroup-Single".into()), + HeaderName::Other("X-AddressesGroup".into()), + ] { + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: false, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Addresses, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Addresses, + name: header.as_str().to_string(), + all: false, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::GroupedAddresses, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::GroupedAddresses, + name: header.as_str().to_string(), + all: false, + })); + } + + for header in [ + HeaderName::Rfc(RfcHeader::ListPost), + HeaderName::Rfc(RfcHeader::ListSubscribe), + HeaderName::Rfc(RfcHeader::ListUnsubscribe), + HeaderName::Rfc(RfcHeader::ListOwner), + HeaderName::Other("X-List-Single".into()), + HeaderName::Other("X-List".into()), + ] { + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: false, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::URLs, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::URLs, + name: header.as_str().to_string(), + all: false, + })); + } + + for header in [ + HeaderName::Rfc(RfcHeader::Date), + HeaderName::Rfc(RfcHeader::ResentDate), + HeaderName::Other("X-Date-Single".into()), + HeaderName::Other("X-Date".into()), + ] { + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: false, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Date, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Date, + name: header.as_str().to_string(), + all: false, + })); + } + + for header in [ + HeaderName::Rfc(RfcHeader::MessageId), + HeaderName::Rfc(RfcHeader::References), + HeaderName::Other("X-Id-Single".into()), + HeaderName::Other("X-Id".into()), + ] { + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: false, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::MessageIds, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::MessageIds, + name: header.as_str().to_string(), + all: false, + })); + } + + for header in [ + HeaderName::Rfc(RfcHeader::Subject), + HeaderName::Rfc(RfcHeader::Keywords), + HeaderName::Other("X-Text-Single".into()), + HeaderName::Other("X-Text".into()), + ] { + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Raw, + name: header.as_str().to_string(), + all: false, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Text, + name: header.as_str().to_string(), + all: true, + })); + properties.push(email::Property::Header(Header { + form: HeaderForm::Text, + name: header.as_str().to_string(), + all: false, + })); + } + + properties +} diff --git a/tests/src/jmap/mod.rs b/tests/src/jmap/mod.rs new file mode 100644 index 00000000..97838425 --- /dev/null +++ b/tests/src/jmap/mod.rs @@ -0,0 +1,149 @@ +use std::sync::Arc; + +use jmap::{api::SessionManager, JMAP}; +use jmap_client::client::{Client, Credentials}; +use jmap_proto::types::id::Id; +use tokio::sync::watch; + +use crate::{add_test_certs, store::TempDir}; + +pub mod email_get; + +const SERVER: &str = " +[server] +hostname = 'jmap.example.org' + +[server.listener.jmap] +bind = ['127.0.0.1:8899'] +url = 'https://127.0.0.1:8899' +protocol = 'jmap' + +[server.socket] +reuse-addr = true + +[server.tls] +enable = true +implicit = false +certificate = 'default' + +[store] +db.path = '{TMP}/sqlite.db' +blob.path = '{TMP}' + +[certificate.default] +cert = 'file://{CERT}' +private-key = 'file://{PK}' +"; + +#[tokio::test] +pub async fn jmap_tests() { + tracing::subscriber::set_global_default( + tracing_subscriber::FmtSubscriber::builder() + .with_max_level(tracing::Level::WARN) + .finish(), + ) + .unwrap(); + + let delete = true; + let mut params = init_jmap_tests(delete).await; + email_get::test(params.server.clone(), &mut params.client).await; + if delete { + params.temp_dir.delete(); + } +} + +#[allow(dead_code)] +struct JMAPTest { + server: Arc, + client: Client, + temp_dir: TempDir, + shutdown_tx: watch::Sender, +} + +async fn init_jmap_tests(delete_if_exists: bool) -> JMAPTest { + // Load and parse config + let temp_dir = TempDir::new("jmap_tests", delete_if_exists); + let settings = utils::config::Config::parse( + &add_test_certs(SERVER).replace("{TMP}", &temp_dir.path.display().to_string()), + ) + .unwrap(); + let servers = settings.parse_servers().unwrap(); + + // Start JMAP server + let manager = SessionManager::from(JMAP::new(&settings).await); + let shutdown_tx = servers.spawn(&settings, |server, shutdown_rx| { + server.spawn(manager.clone(), shutdown_rx); + }); + + // Create client + let mut client = Client::new() + .credentials(Credentials::bearer("DO_NOT_ATTEMPT_THIS_AT_HOME")) + .accept_invalid_certs(true) + .connect("https://127.0.0.1:8899") + .await + .unwrap(); + client.set_default_account_id(Id::new(1)); + + JMAPTest { + server: manager.inner, + temp_dir, + client, + shutdown_tx, + } +} + +pub fn find_values(string: &str, name: &str) -> Vec { + let mut last_pos = 0; + let mut values = Vec::new(); + + while let Some(pos) = string[last_pos..].find(name) { + let mut value = string[last_pos + pos + name.len()..] + .split('"') + .nth(1) + .unwrap(); + if value.ends_with('\\') { + value = &value[..value.len() - 1]; + } + values.push(value.to_string()); + last_pos += pos + name.len(); + } + + values +} + +pub fn replace_values(mut string: String, find: &[String], replace: &[String]) -> String { + for (find, replace) in find.iter().zip(replace.iter()) { + string = string.replace(find, replace); + } + string +} + +pub fn replace_boundaries(string: String) -> String { + let values = find_values(&string, "boundary="); + if !values.is_empty() { + replace_values( + string, + &values, + &(0..values.len()) + .map(|i| format!("boundary_{}", i)) + .collect::>(), + ) + } else { + string + } +} + +pub fn replace_blob_ids(string: String) -> String { + let values = find_values(&string, "blobId\":"); + if !values.is_empty() { + replace_values( + string, + &values, + &(0..values.len()) + .map(|i| format!("blob_{}", i)) + .collect::>(), + ) + } else { + string + } +} diff --git a/tests/src/lib.rs b/tests/src/lib.rs index 5d6a9ee3..3f52fa41 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -1,2 +1,20 @@ +use std::path::PathBuf; + +#[cfg(test)] +pub mod jmap; + #[cfg(test)] pub mod store; + +pub fn add_test_certs(config: &str) -> String { + let mut cert_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + cert_path.push("resources"); + let mut cert = cert_path.clone(); + cert.push("tls_cert.pem"); + let mut pk = cert_path.clone(); + pk.push("tls_privatekey.pem"); + + config + .replace("{CERT}", cert.as_path().to_str().unwrap()) + .replace("{PK}", pk.as_path().to_str().unwrap()) +} diff --git a/tests/src/store/mod.rs b/tests/src/store/mod.rs index 1c1481fa..c35cb35c 100644 --- a/tests/src/store/mod.rs +++ b/tests/src/store/mod.rs @@ -7,15 +7,20 @@ use std::{io::Read, sync::Arc}; use ::store::Store; use utils::config::Config; -struct TempDir { - path: std::path::PathBuf, +pub struct TempDir { + pub path: std::path::PathBuf, } #[tokio::test] -pub async fn store_test() { - let temp_dir = TempDir::new("store_tests", true); +pub async fn store_tests() { + let insert = false; + let temp_dir = TempDir::new("store_tests", insert); let config_file = format!( - concat!("[blob.store]\n", "path = \"{}\"\n", "hash = 1\n"), + concat!( + "store.blob.path = \"{}\"\n", + "store.db.path = \"{}/sqlite.db\"\n" + ), + temp_dir.path.display(), temp_dir.path.display() ); let db = Arc::new( @@ -23,20 +28,17 @@ pub async fn store_test() { .await .unwrap(), ); - let insert = true; if insert { db.destroy().await; } //assign_id::test(db).await; - blobs::test(db).await; - //query::test(db, insert).await; + //blobs::test(db).await; + query::test(db, insert).await; temp_dir.delete(); } pub fn deflate_artwork_data() -> Vec { let mut csv_path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); - csv_path.push("src"); - csv_path.push("tests"); csv_path.push("resources"); csv_path.push("artwork_data.csv.gz"); diff --git a/tests/src/store/query.rs b/tests/src/store/query.rs index c1e864a1..71b4e157 100644 --- a/tests/src/store/query.rs +++ b/tests/src/store/query.rs @@ -26,6 +26,7 @@ use std::{ time::Instant, }; +use jmap_proto::types::keyword::Keyword; use store::{ahash::AHashMap, query::sort::Pagination}; use store::{ @@ -154,7 +155,7 @@ pub async fn test(db: Arc, do_insert: bool) { if !field.is_empty() { builder.value( field_id, - field.to_lowercase(), + Keyword::Other(field.to_lowercase()), F_VALUE | F_INDEX | F_BITMAP, ); } @@ -249,7 +250,7 @@ pub async fn test_filter(db: Arc) { ( vec![ Filter::has_text(fields["artist"], "mauro kunst", Language::None), - Filter::has_keyword(fields["artistRole"], "artist"), + Filter::is_in_bitmap(fields["artistRole"], Keyword::Other("artist".to_string())), Filter::Or, Filter::eq(fields["year"], 1969u32), Filter::eq(fields["year"], 1971u32), @@ -283,7 +284,7 @@ pub async fn test_filter(db: Arc) { ( vec![ Filter::And, - Filter::has_keyword(fields["artist"], "warhol"), + Filter::has_text(fields["artist"], "warhol", Language::None), Filter::Not, Filter::has_english_text(fields["title"], "'campbell'"), Filter::End,