diff --git a/CHANGELOG.md b/CHANGELOG.md index 0240267..294c792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +mail-parser 0.4.0 +================================ +- Lazy conversion to/from HTML an plain text parts. +- Improved API. +- Parts are now generics. + mail-parser 0.3.1 ================================ - Support for non-standard headers. diff --git a/Cargo.lock b/Cargo.lock index b9bd374..5949fbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,7 +59,7 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "mail-parser" -version = "0.3.1" +version = "0.4.0" dependencies = [ "encoding_rs", "serde", diff --git a/Cargo.toml b/Cargo.toml index 72f010f..f9a4c2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mail-parser" description = "Fast and robust e-mail parsing library for Rust" -version = "0.3.1" +version = "0.4.0" edition = "2018" authors = [ "Stalwart Labs "] license = "Apache-2.0 OR MIT" diff --git a/README.md b/README.md index 3db4ef4..63c9ad3 100644 --- a/README.md +++ b/README.md @@ -35,42 +35,46 @@ Performance and memory safety were two important factors while designing _mail-p ## Usage Example ```rust - let input = concat!( - "From: Art Vandelay (Vandelay Industries)\n", - "To: \"Colleagues\": \"James Smythe\" ; Friends:\n", - " jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= ;\n", - "Date: Sat, 20 Nov 2021 14:22:01 -0800\n", - "Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?=\n", - "Content-Type: multipart/mixed; boundary=\"festivus\";\n\n", - "--festivus\n", - "Content-Type: text/html; charset=\"us-ascii\"\n", - "Content-Transfer-Encoding: base64\n\n", - "PGh0bWw+PHA+SSB3YXMgdGhpbmtpbmcgYWJvdXQgcXVpdHRpbmcgdGhlICZsZHF1bztle\n", - "HBvcnRpbmcmcmRxdW87IHRvIGZvY3VzIGp1c3Qgb24gdGhlICZsZHF1bztpbXBvcnRpbm\n", - "cmcmRxdW87LDwvcD48cD5idXQgdGhlbiBJIHRob3VnaHQsIHdoeSBub3QgZG8gYm90aD8\n", - "gJiN4MjYzQTs8L3A+PC9odG1sPg==\n", - "--festivus\n", - "Content-Type: message/rfc822\n\n", - "From: \"Cosmo Kramer\" \n", - "Subject: Exporting my book about coffee tables\n", - "Content-Type: multipart/mixed; boundary=\"giddyup\";\n\n", - "--giddyup\n", - "Content-Type: text/plain; charset=\"utf-16\"\n", - "Content-Transfer-Encoding: quoted-printable\n\n", - "=FF=FE=0C!5=D8\"=DD5=D8)=DD5=D8-=DD =005=D8*=DD5=D8\"=DD =005=D8\"=\n", - "=DD5=D85=DD5=D8-=DD5=D8,=DD5=D8/=DD5=D81=DD =005=D8*=DD5=D86=DD =\n", - "=005=D8=1F=DD5=D8,=DD5=D8,=DD5=D8(=DD =005=D8-=DD5=D8)=DD5=D8\"=\n", - "=DD5=D8=1E=DD5=D80=DD5=D8\"=DD!=00\n", - "--giddyup\n", - "Content-Type: image/gif; name*1=\"about \"; name*0=\"Book \";\n", - " name*2*=utf-8''%e2%98%95 tables.gif\n", - "Content-Transfer-Encoding: Base64\n", - "Content-Disposition: attachment\n\n", - "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\n", - "--giddyup--\n", - "--festivus--\n", - ) - .as_bytes(); + let input = br#"From: Art Vandelay (Vandelay Industries) +To: "Colleagues": "James Smythe" ; Friends: + jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= ; +Date: Sat, 20 Nov 2021 14:22:01 -0800 +Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?= +Content-Type: multipart/mixed; boundary="festivus"; + +--festivus +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: base64 + +PGh0bWw+PHA+SSB3YXMgdGhpbmtpbmcgYWJvdXQgcXVpdHRpbmcgdGhlICZsZHF1bztle +HBvcnRpbmcmcmRxdW87IHRvIGZvY3VzIGp1c3Qgb24gdGhlICZsZHF1bztpbXBvcnRpbm +cmcmRxdW87LDwvcD48cD5idXQgdGhlbiBJIHRob3VnaHQsIHdoeSBub3QgZG8gYm90aD8 +gJiN4MjYzQTs8L3A+PC9odG1sPg== +--festivus +Content-Type: message/rfc822 + +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-- +"#; let message = Message::parse(input).unwrap(); @@ -119,9 +123,9 @@ Performance and memory safety were two important factors while designing _mail-p "Why not both importing AND exporting? ☺" ); - // HTML and text body parts are returned conforming to RFC8621, Section 4.1.4 + // HTML and text body parts are returned conforming to RFC8621, Section 4.1.4 assert_eq!( - message.get_html_body(0).unwrap().to_string(), + message.get_html_body(0).unwrap(), concat!( "

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

but then I thought,", @@ -131,7 +135,7 @@ Performance and memory safety were two important factors while designing _mail-p // HTML parts are converted to plain text (and viceversa) when missing assert_eq!( - message.get_text_body(0).unwrap().to_string(), + message.get_text_body(0).unwrap(), concat!( "I was thinking about quitting the “exporting” to focus just on the", " “importing”,\nbut then I thought, why not do both? ☺\n" @@ -139,10 +143,11 @@ Performance and memory safety were two important factors while designing _mail-p ); // Supports nested messages as well as multipart/digest - let nested_message = match message.get_attachment(0).unwrap() { - MessagePart::Message(v) => v, - _ => unreachable!(), - }; + let nested_message = message + .get_attachment(0) + .unwrap() + .unwrap_message() + .get_body(); assert_eq!( nested_message.get_subject().unwrap(), @@ -151,18 +156,15 @@ Performance and memory safety were two important factors while designing _mail-p // Handles UTF-* as well as many legacy encodings assert_eq!( - nested_message.get_text_body(0).unwrap().to_string(), + nested_message.get_text_body(0).unwrap(), "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" ); assert_eq!( - nested_message.get_html_body(0).unwrap().to_string(), + nested_message.get_html_body(0).unwrap(), "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" ); - let nested_attachment = match nested_message.get_attachment(0).unwrap() { - MessagePart::Binary(v) => v, - _ => unreachable!(), - }; + let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary(); assert_eq!(nested_attachment.len(), 42); diff --git a/examples/email_to_json_and_yaml.rs b/examples/export_to_json_and_yaml.rs similarity index 90% rename from examples/email_to_json_and_yaml.rs rename to examples/export_to_json_and_yaml.rs index 806209f..ac87a43 100644 --- a/examples/email_to_json_and_yaml.rs +++ b/examples/export_to_json_and_yaml.rs @@ -102,7 +102,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 // HTML and text body parts are returned conforming to RFC8621, Section 4.1.4 assert_eq!( - message.get_html_body(0).unwrap().to_string(), + message.get_html_body(0).unwrap(), concat!( "

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

but then I thought,", @@ -112,7 +112,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 // HTML parts are converted to plain text (and viceversa) when missing assert_eq!( - message.get_text_body(0).unwrap().to_string(), + message.get_text_body(0).unwrap(), concat!( "I was thinking about quitting the “exporting” to focus just on the", " “importing”,\nbut then I thought, why not do both? ☺\n" @@ -120,10 +120,11 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 ); // Supports nested messages as well as multipart/digest - let nested_message = match message.get_attachment(0).unwrap() { - MessagePart::Message(v) => v, - _ => unreachable!(), - }; + let nested_message = message + .get_attachment(0) + .unwrap() + .unwrap_message() + .get_body(); assert_eq!( nested_message.get_subject().unwrap(), @@ -132,18 +133,15 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 // Handles UTF-* as well as many legacy encodings assert_eq!( - nested_message.get_text_body(0).unwrap().to_string(), + nested_message.get_text_body(0).unwrap(), "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" ); assert_eq!( - nested_message.get_html_body(0).unwrap().to_string(), + nested_message.get_html_body(0).unwrap(), "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" ); - let nested_attachment = match nested_message.get_attachment(0).unwrap() { - MessagePart::Binary(v) => v, - _ => unreachable!(), - }; + let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary(); assert_eq!(nested_attachment.len(), 42); diff --git a/examples/write_attachments.rs b/examples/write_attachments.rs new file mode 100644 index 0000000..d0ffc7c --- /dev/null +++ b/examples/write_attachments.rs @@ -0,0 +1,87 @@ +/* + * Copyright Stalwart Labs, Minter Ltd. See the COPYING + * file at the top-level directory of this distribution. + * + * Licensed under the Apache License, Version 2.0 or the MIT license + * , at your + * option. This file may not be copied, modified, or distributed + * except according to those terms. + */ + +use mail_parser::*; + +fn main() { + let input = br#"From: Art Vandelay (Vandelay Industries) +To: "Colleagues": "James Smythe" ; Friends: + jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= ; +Date: Sat, 20 Nov 2021 14:22:01 -0800 +Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?= +Content-Type: multipart/mixed; boundary="festivus"; + +--festivus +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: base64 + +PGh0bWw+PHA+SSB3YXMgdGhpbmtpbmcgYWJvdXQgcXVpdHRpbmcgdGhlICZsZHF1bztle +HBvcnRpbmcmcmRxdW87IHRvIGZvY3VzIGp1c3Qgb24gdGhlICZsZHF1bztpbXBvcnRpbm +cmcmRxdW87LDwvcD48cD5idXQgdGhlbiBJIHRob3VnaHQsIHdoeSBub3QgZG8gYm90aD8 +gJiN4MjYzQTs8L3A+PC9odG1sPg== +--festivus +Content-Type: message/rfc822; name="Exporting my book about coffee tables.eml" +Content-Disposition: inline; filename="Exporting my book about coffee tables.eml" +Content-Transfer-Encoding: 7bit + +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-- +"#; + + write_attachments(&Message::parse(input).unwrap()); +} + +fn write_attachments(message: &Message) { + for attachment in message.get_attachments() { + match attachment { + MessagePart::Text(text) | MessagePart::Html(text) => write_part(text), + MessagePart::Binary(blob) | MessagePart::InlineBinary(blob) => write_part(blob), + MessagePart::Message(message) => { + write_part(message); + write_attachments(message.get_body()); + } + _ => (), + } + } +} + +fn write_part<'x>(part: &'x impl BodyPart<'x>) { + std::fs::write( + part.get_content_disposition() + .and_then(|cd| cd.get_attribute("filename")) + .unwrap_or_else(|| { + part.get_content_type() + .and_then(|ct| ct.get_attribute("name")) + .unwrap_or("Untitled") + }), + part.get_contents(), + ) + .unwrap(); +} diff --git a/src/lib.rs b/src/lib.rs index b07cb8f..e659ab9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -112,42 +112,46 @@ //! ``` //! use mail_parser::*; //! -//! let input = concat!( -//! "From: Art Vandelay (Vandelay Industries)\n", -//! "To: \"Colleagues\": \"James Smythe\" ; Friends:\n", -//! " jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= ;\n", -//! "Date: Sat, 20 Nov 2021 14:22:01 -0800\n", -//! "Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?=\n", -//! "Content-Type: multipart/mixed; boundary=\"festivus\";\n\n", -//! "--festivus\n", -//! "Content-Type: text/html; charset=\"us-ascii\"\n", -//! "Content-Transfer-Encoding: base64\n\n", -//! "PGh0bWw+PHA+SSB3YXMgdGhpbmtpbmcgYWJvdXQgcXVpdHRpbmcgdGhlICZsZHF1bztle\n", -//! "HBvcnRpbmcmcmRxdW87IHRvIGZvY3VzIGp1c3Qgb24gdGhlICZsZHF1bztpbXBvcnRpbm\n", -//! "cmcmRxdW87LDwvcD48cD5idXQgdGhlbiBJIHRob3VnaHQsIHdoeSBub3QgZG8gYm90aD8\n", -//! "gJiN4MjYzQTs8L3A+PC9odG1sPg==\n", -//! "--festivus\n", -//! "Content-Type: message/rfc822\n\n", -//! "From: \"Cosmo Kramer\" \n", -//! "Subject: Exporting my book about coffee tables\n", -//! "Content-Type: multipart/mixed; boundary=\"giddyup\";\n\n", -//! "--giddyup\n", -//! "Content-Type: text/plain; charset=\"utf-16\"\n", -//! "Content-Transfer-Encoding: quoted-printable\n\n", -//! "=FF=FE=0C!5=D8\"=DD5=D8)=DD5=D8-=DD =005=D8*=DD5=D8\"=DD =005=D8\"=\n", -//! "=DD5=D85=DD5=D8-=DD5=D8,=DD5=D8/=DD5=D81=DD =005=D8*=DD5=D86=DD =\n", -//! "=005=D8=1F=DD5=D8,=DD5=D8,=DD5=D8(=DD =005=D8-=DD5=D8)=DD5=D8\"=\n", -//! "=DD5=D8=1E=DD5=D80=DD5=D8\"=DD!=00\n", -//! "--giddyup\n", -//! "Content-Type: image/gif; name*1=\"about \"; name*0=\"Book \";\n", -//! " name*2*=utf-8''%e2%98%95 tables.gif\n", -//! "Content-Transfer-Encoding: Base64\n", -//! "Content-Disposition: attachment\n\n", -//! "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\n", -//! "--giddyup--\n", -//! "--festivus--\n", -//! ) -//! .as_bytes(); +//! let input = br#"From: Art Vandelay (Vandelay Industries) +//!To: "Colleagues": "James Smythe" ; Friends: +//! jane@example.com, =?UTF-8?Q?John_Sm=C3=AEth?= ; +//!Date: Sat, 20 Nov 2021 14:22:01 -0800 +//!Subject: Why not both importing AND exporting? =?utf-8?b?4pi6?= +//!Content-Type: multipart/mixed; boundary="festivus"; +//! +//!--festivus +//!Content-Type: text/html; charset="us-ascii" +//!Content-Transfer-Encoding: base64 +//! +//!PGh0bWw+PHA+SSB3YXMgdGhpbmtpbmcgYWJvdXQgcXVpdHRpbmcgdGhlICZsZHF1bztle +//!HBvcnRpbmcmcmRxdW87IHRvIGZvY3VzIGp1c3Qgb24gdGhlICZsZHF1bztpbXBvcnRpbm +//!cmcmRxdW87LDwvcD48cD5idXQgdGhlbiBJIHRob3VnaHQsIHdoeSBub3QgZG8gYm90aD8 +//!gJiN4MjYzQTs8L3A+PC9odG1sPg== +//!--festivus +//!Content-Type: message/rfc822 +//! +//!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-- +//!"#; //! //! let message = Message::parse(input).unwrap(); //! @@ -198,7 +202,7 @@ //! //! // HTML and text body parts are returned conforming to RFC8621, Section 4.1.4 //! assert_eq!( -//! message.get_html_body(0).unwrap().to_string(), +//! message.get_html_body(0).unwrap(), //! concat!( //! "

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

but then I thought,", @@ -208,7 +212,7 @@ //! //! // HTML parts are converted to plain text (and viceversa) when missing //! assert_eq!( -//! message.get_text_body(0).unwrap().to_string(), +//! message.get_text_body(0).unwrap(), //! concat!( //! "I was thinking about quitting the “exporting” to focus just on the", //! " “importing”,\nbut then I thought, why not do both? ☺\n" @@ -216,10 +220,11 @@ //! ); //! //! // Supports nested messages as well as multipart/digest -//! let nested_message = match message.get_attachment(0).unwrap() { -//! MessagePart::Message(v) => v, -//! _ => unreachable!(), -//! }; +//! let nested_message = message +//! .get_attachment(0) +//! .unwrap() +//! .unwrap_message() +//! .get_body(); //! //! assert_eq!( //! nested_message.get_subject().unwrap(), @@ -228,18 +233,15 @@ //! //! // Handles UTF-* as well as many legacy encodings //! assert_eq!( -//! nested_message.get_text_body(0).unwrap().to_string(), +//! nested_message.get_text_body(0).unwrap(), //! "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" //! ); //! assert_eq!( -//! nested_message.get_html_body(0).unwrap().to_string(), +//! nested_message.get_html_body(0).unwrap(), //! "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" //! ); //! -//! let nested_attachment = match nested_message.get_attachment(0).unwrap() { -//! MessagePart::Binary(v) => v, -//! _ => unreachable!(), -//! }; +//! let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary(); //! //! assert_eq!(nested_attachment.len(), 42); //! @@ -307,7 +309,7 @@ pub struct Message<'x> { serde(skip_serializing_if = "Vec::is_empty") )] #[cfg_attr(feature = "serde_support", serde(default))] - pub attachments: Vec, + pub attachments: Vec, #[cfg_attr( feature = "serde_support", @@ -323,23 +325,8 @@ pub struct Message<'x> { pub offset_header: usize, pub offset_body: usize, pub offset_end: usize, -} - -/// Attachment type -#[derive(Debug, PartialEq)] -#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] -pub enum AttachmentType { - Inline(MessagePartId), - Attachment(MessagePartId), -} - -impl AttachmentType { - pub fn unwrap(&self) -> (MessagePartId, bool) { - match self { - AttachmentType::Inline(id) => (*id, false), - AttachmentType::Attachment(id) => (*id, true), - } - } + #[cfg_attr(feature = "serde_support", serde(skip))] + pub raw_message: &'x [u8], } /// Body structure. @@ -357,33 +344,28 @@ impl Default for MessageStructure { } } -/// A text message part. +// Part of the message. #[derive(Debug, Default, PartialEq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] -pub struct TextPart<'x> { +pub struct Part<'x, T> { #[cfg_attr( feature = "serde_support", serde(skip_serializing_if = "HashMap::is_empty") )] #[cfg_attr(feature = "serde_support", serde(default))] pub headers: RfcHeaders<'x>, - pub contents: Cow<'x, str>, - pub is_html: bool, + + pub body: T, } -/// A binary (`[u8]`) message part. -#[derive(Debug, Default, PartialEq)] -#[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] -pub struct BinaryPart<'x> { - #[cfg_attr( - feature = "serde_support", - serde(skip_serializing_if = "HashMap::is_empty") - )] - #[cfg_attr(feature = "serde_support", serde(default))] - pub headers: RfcHeaders<'x>, - #[cfg_attr(feature = "serde_support", serde(with = "serde_bytes"))] - #[cfg_attr(feature = "serde_support", serde(borrow))] - pub contents: Cow<'x, [u8]>, +impl<'x, T> Part<'x, T> { + pub fn new(headers: RfcHeaders<'x>, body: T) -> Self { + Self { headers, body } + } + + pub fn get_body(&self) -> &T { + &self.body + } } /// Unique ID representing a MIME part within a message. @@ -400,19 +382,51 @@ pub type MessagePartId = usize; #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub enum MessagePart<'x> { /// Any text/* part - Text(TextPart<'x>), + Text(Part<'x, Cow<'x, str>>), + + /// A text/html part + Html(Part<'x, Cow<'x, str>>), /// Any other part type that is not text. #[cfg_attr(feature = "serde_support", serde(borrow))] - Binary(BinaryPart<'x>), + Binary(Part<'x, Cow<'x, [u8]>>), + + /// Any inline binary data that. + #[cfg_attr(feature = "serde_support", serde(borrow))] + InlineBinary(Part<'x, Cow<'x, [u8]>>), /// Nested RFC5322 message. - Message(Message<'x>), + Message(Part<'x, Box>>), /// Multipart part Multipart(RfcHeaders<'x>), } +impl<'x> MessagePart<'x> { + pub fn unwrap_text(&self) -> &Part<'x, Cow<'x, str>> { + match self { + MessagePart::Text(part) => part, + MessagePart::Html(part) => part, + _ => panic!("Expected text part."), + } + } + + pub fn unwrap_binary(&self) -> &Part<'x, Cow<'x, [u8]>> { + match self { + MessagePart::Binary(part) => part, + MessagePart::InlineBinary(part) => part, + _ => panic!("Expected binary part."), + } + } + + pub fn unwrap_message(&self) -> &Part<'x, Box>> { + match self { + MessagePart::Message(part) => part, + _ => panic!("Expected message part."), + } + } +} + /// An RFC5322 or RFC2369 internet address. #[derive(Debug, PartialEq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] @@ -876,52 +890,53 @@ impl<'x> Message<'x> { fn get_part(&self, list: &'x [MessagePartId], pos: usize) -> Option<&'x dyn BodyPart> { match self.parts.get(*list.get(pos)?)? { MessagePart::Text(v) => Some(v), + MessagePart::Html(v) => Some(v), MessagePart::Binary(v) => Some(v), + MessagePart::InlineBinary(v) => Some(v), + MessagePart::Message(v) => Some(v), _ => None, } } /// Returns the transformed contents an inline HTML body part by position - pub fn get_html_body(&self, pos: usize) -> Option> { + pub fn get_html_body(&'x self, pos: usize) -> Option> { match self.parts.get(*self.html_body.get(pos)?)? { - MessagePart::Text(text) => { - if text.is_html { - Some(text.contents.clone()) - } else { - Some(text_to_html(text.contents.as_ref()).into()) - } - } + MessagePart::Html(html) => Some(html.body.as_ref().into()), + MessagePart::Text(text) => Some(text_to_html(text.body.as_ref()).into()), _ => None, } } /// Returns the transformed contents an inline text body part by position - pub fn get_text_body(&self, pos: usize) -> Option> { + pub fn get_text_body(&'x self, pos: usize) -> Option> { match self.parts.get(*self.text_body.get(pos)?)? { - MessagePart::Text(text) => { - if !text.is_html { - Some(text.contents.clone()) - } else { - Some(html_to_text(text.contents.as_ref()).into()) - } - } + MessagePart::Text(text) => Some(text.body.as_ref().into()), + MessagePart::Html(html) => Some(html_to_text(html.body.as_ref()).into()), _ => None, } } /// Returns an inline HTML body part by position - pub fn get_html_part(&self, pos: usize) -> Option<&dyn BodyPart> { - self.get_part(&self.html_body, pos) + pub fn get_html_part(&self, pos: usize) -> Option<&Part>> { + match self.parts.get(*self.html_body.get(pos)?)? { + MessagePart::Html(html) => Some(html), + MessagePart::Text(text) => Some(text), + _ => None, + } } /// Returns an inline text body part by position - pub fn get_text_part(&self, pos: usize) -> Option<&dyn BodyPart> { - self.get_part(&self.html_body, pos) + pub fn get_text_part(&self, pos: usize) -> Option<&Part>> { + match self.parts.get(*self.text_body.get(pos)?)? { + MessagePart::Html(html) => Some(html), + MessagePart::Text(text) => Some(text), + _ => None, + } } /// Returns an attacment by position pub fn get_attachment(&self, pos: usize) -> Option<&MessagePart<'x>> { - self.parts.get(self.attachments.get(pos)?.unwrap().0) + self.parts.get(*self.attachments.get(pos)?) } /// Returns the number of plain text body parts @@ -1018,7 +1033,7 @@ impl<'x> MimeHeaders<'x> for Message<'x> { } /// An inline Text or Binary body part. -pub trait BodyPart<'x>: fmt::Display { +pub trait BodyPart<'x>: fmt::Display + MimeHeaders<'x> { /// Returns the body part's contents as a `u8` slice fn get_contents(&'x self) -> &'x [u8]; @@ -1040,9 +1055,9 @@ pub trait BodyPart<'x>: fmt::Display { } } -impl<'x> BodyPart<'x> for TextPart<'x> { +impl<'x> BodyPart<'x> for Part<'x, Cow<'x, str>> { fn get_contents(&'x self) -> &'x [u8] { - self.contents.as_bytes() + self.body.as_bytes() } fn is_text(&self) -> bool { @@ -1054,27 +1069,27 @@ impl<'x> BodyPart<'x> for TextPart<'x> { } fn get_text_contents(&'x self) -> &'x str { - self.contents.as_ref() + self.body.as_ref() } fn len(&self) -> usize { - self.contents.len() + self.body.len() } } -impl<'x> fmt::Display for TextPart<'x> { +impl<'x> fmt::Display for Part<'x, Cow<'x, str>> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - fmt.write_str(self.contents.as_ref()) + fmt.write_str(self.body.as_ref()) } } -impl<'x> BodyPart<'x> for BinaryPart<'x> { +impl<'x> BodyPart<'x> for Part<'x, Cow<'x, [u8]>> { fn get_contents(&'x self) -> &'x [u8] { - self.contents.as_ref() + self.body.as_ref() } fn get_text_contents(&'x self) -> &'x str { - std::str::from_utf8(self.contents.as_ref()).unwrap_or("") + std::str::from_utf8(self.body.as_ref()).unwrap_or("") } fn is_text(&self) -> bool { @@ -1086,61 +1101,45 @@ impl<'x> BodyPart<'x> for BinaryPart<'x> { } fn len(&self) -> usize { - self.contents.len() + self.body.len() } } -impl<'x> fmt::Display for BinaryPart<'x> { +impl<'x> fmt::Display for Part<'x, Cow<'x, [u8]>> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.write_str("[binary contents]") } } -impl<'x> MimeHeaders<'x> for TextPart<'x> { - fn get_content_description(&self) -> Option<&str> { - self.headers - .get(&HeaderName::ContentDescription) - .and_then(|header| header.as_text_ref()) +impl<'x> BodyPart<'x> for Part<'x, Box>> { + fn get_contents(&'x self) -> &'x [u8] { + self.body.raw_message } - fn get_content_disposition(&self) -> Option<&ContentType> { - self.headers - .get(&HeaderName::ContentDisposition) - .and_then(|header| header.as_content_type_ref()) + fn get_text_contents(&'x self) -> &'x str { + std::str::from_utf8(self.body.raw_message).unwrap_or("") } - fn get_content_id(&self) -> Option<&str> { - self.headers - .get(&HeaderName::ContentId) - .and_then(|header| header.as_text_ref()) + fn is_text(&self) -> bool { + false } - fn get_content_transfer_encoding(&self) -> Option<&str> { - self.headers - .get(&HeaderName::ContentTransferEncoding) - .and_then(|header| header.as_text_ref()) + fn is_binary(&self) -> bool { + true } - fn get_content_type(&self) -> Option<&ContentType> { - self.headers - .get(&HeaderName::ContentType) - .and_then(|header| header.as_content_type_ref()) - } - - fn get_content_language(&self) -> &HeaderValue<'x> { - self.headers - .get(&HeaderName::ContentLanguage) - .unwrap_or(&HeaderValue::Empty) - } - - fn get_content_location(&self) -> Option<&str> { - self.headers - .get(&HeaderName::ContentLocation) - .and_then(|header| header.as_text_ref()) + fn len(&self) -> usize { + self.body.raw_message.len() } } -impl<'x> MimeHeaders<'x> for BinaryPart<'x> { +impl<'x> fmt::Display for Part<'x, Box>> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.write_str(String::from_utf8_lossy(self.body.raw_message).as_ref()) + } +} + +impl<'x, T> MimeHeaders<'x> for Part<'x, T> { fn get_content_description(&self) -> Option<&str> { self.headers .get(&HeaderName::ContentDescription) diff --git a/src/parsers/message.rs b/src/parsers/message.rs index 387e2cb..d4b3732 100644 --- a/src/parsers/message.rs +++ b/src/parsers/message.rs @@ -16,8 +16,8 @@ use crate::{ base64::decode_base64, charsets::map::get_charset_decoder, quoted_printable::decode_quoted_printable, DecodeFnc, DecodeResult, }, - AttachmentType, BinaryPart, ContentType, HeaderName, HeaderValue, Message, MessagePart, - MessagePartId, MessageStructure, RfcHeaders, TextPart, + ContentType, HeaderName, HeaderValue, Message, MessagePart, MessagePartId, MessageStructure, + Part, RfcHeaders, }; use super::{ @@ -185,17 +185,20 @@ impl<'x> Message<'x> { /// This function never panics, a best-effort is made to parse the message and /// if no headers are found None is returned. /// - pub fn parse(bytes: &'x [u8]) -> Option> { - let mut stream = MessageStream::new(bytes); + pub fn parse(raw_message: &'x [u8]) -> Option> { + let mut stream = MessageStream::new(raw_message); let mut message = Message::new(); let mut message_stack = Vec::new(); + let mut message_header_stack = Vec::new(); let mut state = MessageParserState::new(); let mut state_stack = Vec::new(); let mut mime_part_header = RfcHeaders::new(); + message.raw_message = raw_message; + 'outer: loop { // Parse headers let (is_message, header) = if let MimeType::Message = state.mime_type { @@ -291,12 +294,7 @@ impl<'x> Message<'x> { }), ); } - state - .structure - .push(MessageStructure::Part(message.parts.len())); - message.parts.push(MessagePart::Multipart(std::mem::take( - &mut mime_part_header, - ))); + message_header_stack.push(std::mem::take(&mut mime_part_header)); message_stack.push(message); state_stack.push(state); message = Message::new(); @@ -412,10 +410,9 @@ impl<'x> Message<'x> { if is_text { let is_html = mime_type == MimeType::TextHtml; - let text_part = TextPart { - contents: result_to_string(bytes, stream.data, content_type), + let text_part = Part { + body: result_to_string(bytes, stream.data, content_type), headers: std::mem::take(&mut mime_part_header), - is_html, }; if add_to_html && !is_html { @@ -429,14 +426,16 @@ impl<'x> Message<'x> { } else if add_to_text && !is_html { message.text_body.push(message.parts.len()); } else { - message - .attachments - .push(AttachmentType::Attachment(message.parts.len())); + message.attachments.push(message.parts.len()); } state .structure .push(MessageStructure::Part(message.parts.len())); - message.parts.push(MessagePart::Text(text_part)); + message.parts.push(if is_html { + MessagePart::Html(text_part) + } else { + MessagePart::Text(text_part) + }); } else { if add_to_html { message.html_body.push(message.parts.len()); @@ -445,20 +444,22 @@ impl<'x> Message<'x> { message.text_body.push(message.parts.len()); } - message.attachments.push(if is_inline { - AttachmentType::Inline(message.parts.len()) - } else { - AttachmentType::Attachment(message.parts.len()) - }); + message.attachments.push(message.parts.len()); state .structure .push(MessageStructure::Part(message.parts.len())); - message.parts.push(MessagePart::Binary(BinaryPart { - headers: std::mem::take(&mut mime_part_header), - contents: result_to_bytes(bytes, stream.data), - })); + let binary_part = Part::new( + std::mem::take(&mut mime_part_header), + result_to_bytes(bytes, stream.data), + ); + + message.parts.push(if !is_inline { + MessagePart::Binary(binary_part) + } else { + MessagePart::InlineBinary(binary_part) + }); }; if state.mime_boundary.is_some() { @@ -473,10 +474,13 @@ impl<'x> Message<'x> { { message.structure = state.get_structure(); message.offset_end = seek_crlf_end(&stream, last_part_offset); - prev_message - .attachments - .push(AttachmentType::Attachment(prev_message.parts.len())); - prev_message.parts.push(MessagePart::Message(message)); + message.raw_message = + &raw_message[message.offset_header..message.offset_end]; + prev_message.attachments.push(prev_message.parts.len()); + prev_message.parts.push(MessagePart::Message(Part::new( + message_header_stack.pop().unwrap(), + Box::new(message), + ))); message = prev_message; prev_state.mime_boundary = state.mime_boundary; state = prev_state; @@ -545,10 +549,11 @@ impl<'x> Message<'x> { message.offset_end = stream.pos; if !message.is_empty() { message.structure = state.get_structure(); - prev_message - .attachments - .push(AttachmentType::Attachment(prev_message.parts.len())); - prev_message.parts.push(MessagePart::Message(message)); + prev_message.attachments.push(prev_message.parts.len()); + prev_message.parts.push(MessagePart::Message(Part::new( + message_header_stack.pop().unwrap(), + Box::new(message), + ))); } message = prev_message; state = prev_state; @@ -568,7 +573,7 @@ impl<'x> Message<'x> { mod tests { use std::{fs, path::PathBuf}; - use crate::parsers::message::Message; + use crate::{parsers::message::Message, MessagePart}; const SEPARATOR: &[u8] = "\n---- EXPECTED STRUCTURE ----\n".as_bytes(); @@ -603,7 +608,20 @@ mod tests { tests_run += 1; let input = input.split_at_mut(pos); - let message = Message::parse(input.0).unwrap(); + let mut message = Message::parse(input.0).unwrap(); + + // Remove raw message references before comparing + message.raw_message = &[]; + for parts in &mut message.parts { + if let MessagePart::Message(part) = parts { + part.body.raw_message = &[]; + for parts in &mut part.body.parts { + if let MessagePart::Message(part) = parts { + part.body.raw_message = &[]; + } + } + } + } assert_eq!( message, @@ -627,8 +645,8 @@ mod tests { fn message_to_yaml() { let mut file_name = PathBuf::from(env!("CARGO_MANIFEST_DIR")); file_name.push("tests"); - file_name.push("legacy"); - file_name.push("000.txt"); + file_name.push("rfc"); + file_name.push("007.txt"); let mut input = fs::read(&file_name).unwrap(); let mut pos = 0; @@ -646,13 +664,13 @@ mod tests { file_name.display() ); - let input = input.split_at_mut(pos); - let message = Message::parse(input.0).unwrap(); + let input = input.split_at_mut(pos).0; + let message = Message::parse(input).unwrap(); let result = serde_yaml::to_string(&message).unwrap(); fs::write("test.yaml", &result).unwrap(); - println!("{}", result); + println!("{:}", result); } #[test] diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 344ad4b..d622103 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -98,7 +98,7 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 "Why not both importing AND exporting? ☺" ); assert_eq!( - message.get_html_body(0).unwrap().to_string(), + message.get_html_body(0).unwrap(), concat!( "

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

but then I thought,", @@ -106,32 +106,30 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 ) ); assert_eq!( - message.get_text_body(0).unwrap().to_string(), + message.get_text_body(0).unwrap(), concat!( "I was thinking about quitting the “exporting” to focus just on the", " “importing”,\nbut then I thought, why not do both? ☺\n" ) ); - let nested_message = match message.get_attachment(0).unwrap() { - MessagePart::Message(v) => v, - _ => unreachable!(), - }; + let nested_message = message + .get_attachment(0) + .unwrap() + .unwrap_message() + .get_body(); assert_eq!( nested_message.get_subject().unwrap(), "Exporting my book about coffee tables" ); assert_eq!( - nested_message.get_text_body(0).unwrap().to_string(), + nested_message.get_text_body(0).unwrap(), "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" ); assert_eq!( - nested_message.get_html_body(0).unwrap().to_string(), + nested_message.get_html_body(0).unwrap(), "ℌ𝔢𝔩𝔭 𝔪𝔢 𝔢𝔵𝔭𝔬𝔯𝔱 𝔪𝔶 𝔟𝔬𝔬𝔨 𝔭𝔩𝔢𝔞𝔰𝔢!" ); - let nested_attachment = match nested_message.get_attachment(0).unwrap() { - MessagePart::Binary(v) => v, - _ => unreachable!(), - }; + let nested_attachment = nested_message.get_attachment(0).unwrap().unwrap_binary(); assert_eq!(nested_attachment.len(), 42); assert_eq!( nested_attachment diff --git a/tests/legacy/000.txt b/tests/legacy/000.txt index c6a2240..f34fc59 100644 --- a/tests/legacy/000.txt +++ b/tests/legacy/000.txt @@ -45,29 +45,24 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } - } - }, "to": { "Address": { "name": "Joe Blow", "address": "jblow@example.com" } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } } }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, "date": { "DateTime": { "year": 2000, @@ -81,40 +76,45 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" }, "content_transfer_encoding": { "Text": "base64" }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" + "mime_version": { + "Text": "1.0" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" + } + } } }, "headers_other": { + "X-MSMail-Priority": { + "Text": "Normal" + }, "X-MimeOLE": { "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, "X-Priority": { "Text": "3 (Normal)" }, - "X-MSMail-Priority": { - "Text": "Normal" - }, "Importance": { "Text": "Normal" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" } }, "headers_offsets": [ @@ -218,14 +218,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } ], "attachments": [ - { - "Attachment": 0 - } + 0 ], "parts": [ { "Binary": { - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/001.txt b/tests/legacy/001.txt index c1e58cf..db829d1 100644 --- a/tests/legacy/001.txt +++ b/tests/legacy/001.txt @@ -36,12 +36,39 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } }, "content_transfer_encoding": { "Text": "quoted-printable" }, + "to": { + "AddressList": [ + { + "name": "Joe Blow", + "address": "jblow@example.com" + }, + { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + ] + }, + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-7" + } + } + }, "date": { "DateTime": { "year": 2000, @@ -55,55 +82,28 @@ m+APw-ssen als wir.+ACI-=20 "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-7" - } - } - }, - "to": { - "AddressList": [ - { - "name": "Joe Blow", - "address": "jblow@example.com" - }, - { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - ] + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" }, "mime_version": { "Text": "1.0" } }, "headers_other": { - "Importance": { - "Text": "Normal" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, "X-MSMail-Priority": { "Text": "Normal" }, "X-MimeOLE": { "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, + "Importance": { + "Text": "Normal" + }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" } }, "headers_offsets": [ @@ -208,8 +208,7 @@ m+APw-ssen als wir.+ACI-=20 "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } } ], diff --git a/tests/legacy/002.txt b/tests/legacy/002.txt index 5fc92c0..bd32540 100644 --- a/tests/legacy/002.txt +++ b/tests/legacy/002.txt @@ -50,11 +50,26 @@ wir."
"address": "mueller@example.com" } }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "message_id": { + "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" + }, "mime_version": { "Text": "1.0" }, - "content_transfer_encoding": { - "Text": "quoted-printable" + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "iso-8859-1" + } + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" }, "date": { "DateTime": { @@ -68,32 +83,17 @@ wir."
"tz_hour": 4, "tz_minute": 0 } - }, - "message_id": { - "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, "headers_other": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" + "X-Priority": { + "Text": "2 (High)" }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" }, - "X-Priority": { - "Text": "2 (High)" + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" } }, "headers_offsets": [ @@ -183,9 +183,8 @@ wir."
], "parts": [ { - "Text": { - "contents": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\n\n", - "is_html": true + "Html": { + "body": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\n\n" } } ], diff --git a/tests/legacy/003.txt b/tests/legacy/003.txt index 134a116..a0712f6 100644 --- a/tests/legacy/003.txt +++ b/tests/legacy/003.txt @@ -68,27 +68,6 @@ wir."
"subject": { "Text": "Die Hasen und die Frösche" }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "=====================_714967308==_.ALT" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" - }, "date": { "DateTime": { "year": 2000, @@ -102,11 +81,32 @@ wir."
"tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "message_id": { + "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" + }, "to": { "Address": { "name": "Heinz Müller", "address": "mueller@example.com" } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "=====================_714967308==_.ALT" + } + } } }, "headers_other": { @@ -215,13 +215,15 @@ wir."
} } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } }, { - "Text": { + "Html": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -230,13 +232,9 @@ wir."
"charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "contents": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\n", - "is_html": true + "body": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\n" } } ], diff --git a/tests/legacy/004.txt b/tests/legacy/004.txt index d6739ef..41a1691 100644 --- a/tests/legacy/004.txt +++ b/tests/legacy/004.txt @@ -20,27 +20,12 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "subject": { + "Text": "The Hare and the Tortoise" + }, "mime_version": { "Text": "1.0" }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" - }, "date": { "DateTime": { "year": 2000, @@ -60,19 +45,34 @@ Slow but steady wins the race. "address": "dwsauder@example.com" } }, - "subject": { - "Text": "The Hare and the Tortoise" + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" + } + } + }, + "message_id": { + "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } } }, "headers_other": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" }, "X-Priority": { "Text": "5 (Lowest)" + }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" } }, "headers_offsets": [ @@ -156,8 +156,7 @@ Slow but steady wins the race. "parts": [ { "Text": { - "contents": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race. \r\n\r\n", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race. \r\n\r\n" } } ], diff --git a/tests/legacy/005.txt b/tests/legacy/005.txt index 2237ae6..08ea19b 100644 --- a/tests/legacy/005.txt +++ b/tests/legacy/005.txt @@ -34,6 +34,12 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, "from": { "Address": { "name": "Doug Sauder", @@ -53,8 +59,14 @@ m+APw-ssen als wir.+ACI-=20 "tz_minute": 0 } }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } }, "content_type": { "ContentType": { @@ -65,29 +77,17 @@ m+APw-ssen als wir.+ACI-=20 } } }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com" } }, "headers_other": { - "Importance": { - "Text": "Normal" - }, "X-Priority": { "Text": "3 (Normal)" }, + "Importance": { + "Text": "Normal" + }, "X-Mailer": { "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" }, @@ -200,8 +200,7 @@ m+APw-ssen als wir.+ACI-=20 "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n" } } ], diff --git a/tests/legacy/006.txt b/tests/legacy/006.txt index ec2c11a..b61e04b 100644 --- a/tests/legacy/006.txt +++ b/tests/legacy/006.txt @@ -85,36 +85,24 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" - }, "to": { "Address": { "name": "Joe Blow", "address": "jblow@example.com" } }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90" - } - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@example.com" } }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, "date": { "DateTime": { "year": 2000, @@ -127,23 +115,35 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_hour": 4, "tz_minute": 0 } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0004_01BFC037.28F2FA90" + } + } + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" } }, "headers_other": { - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" }, "X-MSMail-Priority": { "Text": "Normal" }, + "X-Priority": { + "Text": "3 (Normal)" + }, "X-Mailer": { "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + "Importance": { + "Text": "Normal" } }, "headers_offsets": [ @@ -233,25 +233,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } ], "attachments": [ - { - "Attachment": 0 - }, - { - "Attachment": 1 - } + 0, + 1 ], "parts": [ { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_disposition": { "ContentType": { @@ -261,11 +251,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1597,6 +1593,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" }, @@ -1607,18 +1612,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/007.txt b/tests/legacy/007.txt index 80b36d7..d915a23 100644 --- a/tests/legacy/007.txt +++ b/tests/legacy/007.txt @@ -33,20 +33,26 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@example.com" } }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + "mime_version": { + "Text": "1.0" }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" }, "date": { "DateTime": { @@ -61,11 +67,8 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" }, "content_type": { "ContentType": { @@ -75,26 +78,23 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "charset": "iso-8859-1" } } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com" } }, "headers_other": { + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, "Importance": { "Text": "Normal" }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, "X-MSMail-Priority": { "Text": "Normal" }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + "X-Priority": { + "Text": "3 (Normal)" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" } }, "headers_offsets": [ @@ -199,8 +199,7 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } } ], diff --git a/tests/legacy/008.txt b/tests/legacy/008.txt index 4a7a41e..8b40061 100644 --- a/tests/legacy/008.txt +++ b/tests/legacy/008.txt @@ -137,17 +137,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0002_01BFC036.AE309650" - } + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } }, "date": { "DateTime": { @@ -162,28 +162,31 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0002_01BFC036.AE309650" + } + } + }, "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "mime_version": { - "Text": "1.0" + "subject": { + "Text": "Test message from Microsoft Outlook 00" } }, "headers_other": { - "X-Priority": { - "Text": "3 (Normal)" + "Importance": { + "Text": "Normal" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" }, "X-MSMail-Priority": { "Text": "Normal" @@ -191,11 +194,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "X-Mailer": { "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" }, - "Importance": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + "X-Priority": { + "Text": "3 (Normal)" } }, "headers_offsets": [ @@ -291,15 +291,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - }, - { - "Attachment": 3 - } + 1, + 2, + 3 ], "parts": [ { @@ -318,15 +312,20 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "Text": "quoted-printable" } }, - "contents": "\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, 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. \n \nSlow but steady wins the race. \n", - "is_html": false + "body": "\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, 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. \n \nSlow but steady wins the race. \n" } }, { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } }, "content_disposition": { "ContentType": { @@ -336,17 +335,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1678,14 +1671,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -1695,11 +1680,19 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3012,6 +3005,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -3020,12 +3016,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "redball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/009.txt b/tests/legacy/009.txt index 4c7edd9..1d6ac26 100644 --- a/tests/legacy/009.txt +++ b/tests/legacy/009.txt @@ -38,12 +38,31 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" + "message_id": { + "Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com" }, "mime_version": { "Text": "1.0" }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1", + "format": "flowed" + } + } + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -57,45 +76,26 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "tz_minute": 0 } }, - "message_id": { - "Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com" - }, "subject": { "Text": "Die Hasen und die Frösche" }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "format": "flowed", - "charset": "iso-8859-1" - } - } } }, "headers_other": { "Disposition-Notification-To": { "Text": "" }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, "X-Priority": { "Text": "1 (Highest)" }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" + }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" } @@ -195,8 +195,7 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "parts": [ { "Text": { - "contents": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein \nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, \nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der \nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; \nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte \neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste \nuntertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein \nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, \nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n", - "is_html": false + "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein \nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, \nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der \nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; \nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte \neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste \nuntertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein \nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, \nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n" } } ], diff --git a/tests/legacy/010.txt b/tests/legacy/010.txt index 4a53bdd..9a01e77 100644 --- a/tests/legacy/010.txt +++ b/tests/legacy/010.txt @@ -23,18 +23,6 @@ In einem nahen Teich wollten sie sich nun ers ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "Die Hasen und die Fr�sche" - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Heinz M�ller", - "address": "mueller@example.com" - } - }, "content_transfer_encoding": { "Text": "8bit" }, @@ -51,6 +39,18 @@ In einem nahen Teich wollten sie sich nun ers "tz_minute": 0 } }, + "message_id": { + "Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com" + }, + "subject": { + "Text": "Die Hasen und die Fr�sche" + }, + "to": { + "Address": { + "name": "Heinz M�ller", + "address": "mueller@example.com" + } + }, "from": { "Address": { "name": "Doug Sauder", @@ -66,19 +66,19 @@ In einem nahen Teich wollten sie sich nun ers } } }, - "message_id": { - "Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com" + "mime_version": { + "Text": "1.0" } }, "headers_other": { - "X-Priority": { - "Text": "1 (Highest)" - }, "X-Sender": { "Text": "dwsauder@pop.example.com (Unverified)" }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "1 (Highest)" } }, "headers_offsets": [ @@ -169,8 +169,7 @@ In einem nahen Teich wollten sie sich nun ers "parts": [ { "Text": { - "contents": "Die Hasen und die Frösche\r\n\r\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 selbst. Auf, laßt uns ein für allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\n\r\n\r\n", - "is_html": false + "body": "Die Hasen und die Frösche\r\n\r\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 selbst. Auf, laßt uns ein für allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\n\r\n\r\n" } } ], diff --git a/tests/legacy/011.txt b/tests/legacy/011.txt index 10c1f49..d136494 100644 --- a/tests/legacy/011.txt +++ b/tests/legacy/011.txt @@ -31,6 +31,12 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "message_id": { + "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" + }, "content_transfer_encoding": { "Text": "quoted-printable" }, @@ -40,6 +46,15 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "address": "dwsauder@example.com" } }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "text", @@ -49,15 +64,6 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= } } }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" - }, "date": { "DateTime": { "year": 2000, @@ -70,12 +76,6 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "tz_hour": 4, "tz_minute": 0 } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" } }, "headers_other": { @@ -167,8 +167,7 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n" } } ], diff --git a/tests/legacy/012.txt b/tests/legacy/012.txt index f2280f9..616ec89 100644 --- a/tests/legacy/012.txt +++ b/tests/legacy/012.txt @@ -32,18 +32,34 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 30, + "second": 20, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@example.com" } }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" + }, "content_type": { "ContentType": { "c_type": "text", @@ -56,44 +72,28 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "subject": { "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 30, - "second": 20, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" } } }, "headers_other": { - "Importance": { - "Text": "Normal" - }, "X-MimeOLE": { "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + "Importance": { + "Text": "Normal" }, "X-Priority": { "Text": "3 (Normal)" }, "X-MSMail-Priority": { "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" } }, "headers_offsets": [ @@ -198,8 +198,7 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n" } } ], diff --git a/tests/legacy/013.txt b/tests/legacy/013.txt index 459a870..d93fb4a 100644 --- a/tests/legacy/013.txt +++ b/tests/legacy/013.txt @@ -33,30 +33,6 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "8bit" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "content_type": { "ContentType": { "c_type": "text", @@ -66,6 +42,30 @@ welche also wohl noch ungl } } }, + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" + }, + "content_transfer_encoding": { + "Text": "8bit" + }, "date": { "DateTime": { "year": 2000, @@ -81,20 +81,20 @@ welche also wohl noch ungl } }, "headers_other": { - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, "X-Priority": { "Text": "3 (Normal)" }, "X-MSMail-Priority": { "Text": "Normal" }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, "Importance": { "Text": "Normal" }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" } }, "headers_offsets": [ @@ -199,8 +199,7 @@ welche also wohl noch ungl "parts": [ { "Text": { - "contents": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod\r\nselbst. Auf, laßt uns ein für allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\r\nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte\r\neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\r\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch unglücklicher sein müssen als wir.\"\r\n\r\n", - "is_html": false + "body": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod\r\nselbst. Auf, laßt uns ein für allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\r\nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte\r\neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\r\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch unglücklicher sein müssen als wir.\"\r\n\r\n" } } ], diff --git a/tests/legacy/014.txt b/tests/legacy/014.txt index 46d1667..9a63093 100644 --- a/tests/legacy/014.txt +++ b/tests/legacy/014.txt @@ -74,6 +74,18 @@ race. =20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" + }, "date": { "DateTime": { "year": 2000, @@ -87,6 +99,15 @@ race. =20 "tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -95,27 +116,6 @@ race. =20 "boundary": "----=_NextPart_000_0005_01BFC037.799BEF60" } } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" } }, "headers_other": { @@ -125,12 +125,12 @@ race. =20 "X-Priority": { "Text": "3 (Normal)" }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, "X-MimeOLE": { "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, "X-MSMail-Priority": { "Text": "Normal" } @@ -231,9 +231,6 @@ race. =20 { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -242,18 +239,17 @@ race. =20 "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "\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, 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. \n \nSlow but steady wins the race. \n\n", - "is_html": false + "body": "\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, 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. \n \nSlow but steady wins the race. \n\n" } }, { - "Text": { + "Html": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -262,10 +258,12 @@ race. =20 "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "\n\n\n\n\n


The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n", - "is_html": true + "body": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n" } } ], diff --git a/tests/legacy/015.txt b/tests/legacy/015.txt index 91b94d6..ad60ac2 100644 --- a/tests/legacy/015.txt +++ b/tests/legacy/015.txt @@ -200,36 +200,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, "message_id": { "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_715392540==_" - } - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "date": { "DateTime": { "year": 2000, @@ -242,17 +215,44 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_715392540==_" + } + } } }, "headers_other": { + "X-Priority": { + "Text": "2 (High)" + }, "X-Sender": { "Text": "dwsauder@pop.example.com (Unverified)" }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "2 (High)" } }, "headers_offsets": [ @@ -334,18 +334,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 2 ], "attachments": [ - { - "Attachment": 4 - }, - { - "Attachment": 5 - }, - { - "Attachment": 6 - }, - { - "Attachment": 7 - } + 4, + 5, + 6, + 7 ], "parts": [ { @@ -355,8 +347,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715392540==_.REL", - "type": "multipart/alternative" + "type": "multipart/alternative", + "boundary": "=====================_715392540==_.REL" } } } @@ -378,9 +370,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -389,18 +378,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n2aa3ed95.png2aa3edd1.png", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n2aa3ed95.png2aa3edd1.png" } }, { - "Text": { + "Html": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -409,15 +397,20 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\"2aa3ed95.png\"\"2aa3edd1.png\"\n", - "is_html": true + "body": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\"2aa3ed95.png\"\"2aa3edd1.png\"\n" } }, { "Binary": { "headers": { + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" + }, "content_transfer_encoding": { "Text": "base64" }, @@ -437,12 +430,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "2aa3ed95.png" } } - }, - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.2" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1774,6 +1764,14 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa3edd1.png" + } + } + }, "content_type": { "ContentType": { "c_type": "image", @@ -1783,22 +1781,14 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa3edd1.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" + }, + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3258,6 +3248,14 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "blueball.png" + } + } + }, "content_type": { "ContentType": { "c_type": "image", @@ -3269,17 +3267,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_transfer_encoding": { "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "blueball.png" - } - } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -4611,14 +4601,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -4630,9 +4612,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_transfer_encoding": { "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/016.txt b/tests/legacy/016.txt index b151944..a1ca100 100644 --- a/tests/legacy/016.txt +++ b/tests/legacy/016.txt @@ -97,24 +97,27 @@ JB@ac)(GTFLiL)!d09'8!!!: ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, "subject": { "Text": "Die Hasen und die Frösche" }, "mime_version": { "Text": "1.0" }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716373961==_" - } - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" - }, "date": { "DateTime": { "year": 2000, @@ -128,25 +131,22 @@ JB@ac)(GTFLiL)!d09'8!!!: "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716373961==_" + } } } }, "headers_other": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" } }, "headers_offsets": [ @@ -221,17 +221,16 @@ JB@ac)(GTFLiL)!d09'8!!!: 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 1, + 2 ], "parts": [ { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -240,13 +239,9 @@ JB@ac)(GTFLiL)!d09'8!!!: "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } }, { @@ -270,7 +265,7 @@ JB@ac)(GTFLiL)!d09'8!!!: } } }, - "contents": [ + "body": [ 13, 10, 40, @@ -2225,7 +2220,7 @@ JB@ac)(GTFLiL)!d09'8!!!: } } }, - "contents": [ + "body": [ 13, 10, 40, diff --git a/tests/legacy/017.txt b/tests/legacy/017.txt index d8cdf07..083c609 100644 --- a/tests/legacy/017.txt +++ b/tests/legacy/017.txt @@ -110,8 +110,8 @@ end "address": "dwsauder@example.com" } }, - "mime_version": { - "Text": "1.0" + "subject": { + "Text": "The Hare and the Tortoise" }, "to": { "Address": { @@ -119,6 +119,9 @@ end "address": "jschmuergen@example.com" } }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -143,9 +146,6 @@ end "tz_hour": 4, "tz_minute": 0 } - }, - "subject": { - "Text": "The Hare and the Tortoise" } }, "headers_other": { @@ -228,12 +228,8 @@ end 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 1, + 2 ], "parts": [ { @@ -249,21 +245,12 @@ end } } }, - "contents": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race. \r\n\r", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race. \r\n\r" } }, { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } - } - }, "content_transfer_encoding": { "Text": "x-uuencode" }, @@ -275,9 +262,17 @@ end "name": "greenball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" + } + } } }, - "contents": [ + "body": [ 13, 10, 98, @@ -2160,7 +2155,7 @@ end } } }, - "contents": [ + "body": [ 13, 10, 98, diff --git a/tests/legacy/018.txt b/tests/legacy/018.txt index ceb2e4a..827470d 100644 --- a/tests/legacy/018.txt +++ b/tests/legacy/018.txt @@ -150,14 +150,23 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "message_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" + }, "to": { "Address": { "name": "Heinz Müller", "address": "mueller@example.com" } }, - "message_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } }, "date": { "DateTime": { @@ -172,15 +181,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "mime_version": { "Text": "1.0" } @@ -275,12 +275,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 1 ], "attachments": [ - { - "Attachment": 3 - }, - { - "Attachment": 4 - } + 3, + 4 ], "parts": [ { @@ -312,16 +308,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "Text": "quoted-printable" } }, - "contents": "blueball.png\n\nDie 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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\nredball.png", - "is_html": false + "body": "blueball.png\n\nDie 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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\nredball.png" } }, { - "Text": { + "Html": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -330,27 +322,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "\n\"blueball.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\"redball.png\"
\n", - "is_html": true + "body": "\n\"blueball.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\"redball.png\"
\n" } }, { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" - }, "content_transfer_encoding": { "Text": "base64" }, @@ -361,9 +343,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "blueball.png" } } + }, + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1695,17 +1689,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "redball.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" - }, "content_type": { "ContentType": { "c_type": "image", @@ -1715,11 +1698,22 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" + }, "content_transfer_encoding": { "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "redball.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/019.txt b/tests/legacy/019.txt index 3ac665a..0033fb9 100644 --- a/tests/legacy/019.txt +++ b/tests/legacy/019.txt @@ -146,6 +146,27 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -155,9 +176,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, "date": { "DateTime": { "year": 2000, @@ -170,30 +188,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_hour": 4, "tz_minute": 0 } - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" - }, - "mime_version": { - "Text": "1.0" } }, "headers_other": { - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, "X-Priority": { "Text": "3 (Normal)" }, @@ -203,6 +200,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "Importance": { "Text": "Normal" }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, "X-Mailer": { "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" } @@ -300,12 +300,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 1 ], "attachments": [ - { - "Attachment": 3 - }, - { - "Attachment": 4 - } + 3, + 4 ], "parts": [ { @@ -337,16 +333,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "Text": "quoted-printable" } }, - "contents": "\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, 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. \n \nSlow but steady wins the race. \n\n", - "is_html": false + "body": "\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, 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. \n \nSlow but steady wins the race. \n\n" } }, { - "Text": { + "Html": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -355,15 +347,28 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n", - "is_html": true + "body": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n" } }, { "Binary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "greenball.png" + } + } + }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -372,20 +377,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "greenball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "greenball.png" - } - } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1690,8 +1684,14 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } }, "content_disposition": { "ContentType": { @@ -1701,17 +1701,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/020.txt b/tests/legacy/020.txt index 3ff744b..a772695 100644 --- a/tests/legacy/020.txt +++ b/tests/legacy/020.txt @@ -33,9 +33,6 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com" - }, "content_type": { "ContentType": { "c_type": "text", @@ -58,43 +55,46 @@ welche also wohl noch ungl "tz_minute": 0 } }, + "subject": { + "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" + }, "to": { "Address": { "name": "J�rgen Schm�rgen", "address": "schmuergen@example.com" } }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com" }, "content_transfer_encoding": { "Text": "8bit" }, "mime_version": { "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } } }, "headers_other": { - "Importance": { - "Text": "Normal" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, "X-MimeOLE": { "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" }, + "X-Priority": { + "Text": "3 (Normal)" + }, + "Importance": { + "Text": "Normal" + }, "X-MSMail-Priority": { "Text": "Normal" }, - "X-Priority": { - "Text": "3 (Normal)" + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" } }, "headers_offsets": [ @@ -199,8 +199,7 @@ welche also wohl noch ungl "parts": [ { "Text": { - "contents": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod\r\nselbst. Auf, laßt uns ein für allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\r\nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte\r\neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\r\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch unglücklicher sein müssen als wir.\"\r\n\r\n", - "is_html": false + "body": "Die Hasen und die Frösche\r\n\r\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod\r\nselbst. Auf, laßt uns ein für allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\r\nallein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte\r\neine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\r\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch unglücklicher sein müssen als wir.\"\r\n\r\n" } } ], diff --git a/tests/legacy/021.txt b/tests/legacy/021.txt index c63595b..caa1781 100644 --- a/tests/legacy/021.txt +++ b/tests/legacy/021.txt @@ -190,20 +190,26 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "----=_NextPart_000_0010_01BFC038.B91BC650" - } + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" } }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, "mime_version": { "Text": "1.0" }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } }, "date": { "DateTime": { @@ -218,37 +224,31 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "----=_NextPart_000_0010_01BFC038.B91BC650" + } } } }, "headers_other": { - "X-MSMail-Priority": { + "Importance": { "Text": "Normal" }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, "X-MimeOLE": { "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" }, - "Importance": { + "X-MSMail-Priority": { "Text": "Normal" + }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, + "X-Priority": { + "Text": "3 (Normal)" } }, "headers_offsets": [ @@ -344,15 +344,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 2 ], "attachments": [ - { - "Attachment": 4 - }, - { - "Attachment": 5 - }, - { - "Attachment": 6 - } + 4, + 5, + 6 ], "parts": [ { @@ -384,6 +378,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -392,18 +389,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "contents": "\n\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, 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. \n \nSlow but steady wins the race. \n\n\n", - "is_html": false + "body": "\n\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, 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. \n \nSlow but steady wins the race. \n\n\n" } }, { - "Text": { + "Html": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -412,13 +408,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "contents": "\n\n\n\n\n
\"blue
\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n

 
\n", - "is_html": true + "body": "\n\n\n\n\n
\"blue
\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue. 
 
Slow but steady wins the race.  \n
\n

 
\n" } }, { @@ -427,6 +419,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "content_id": { "Text": "938014623@17052000-0f9b" }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -435,12 +430,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "blueball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1781,9 +1773,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1791,9 +1780,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3107,6 +3099,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -3114,12 +3109,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/022.txt b/tests/legacy/022.txt index 6d405fb..cfa1f6a 100644 --- a/tests/legacy/022.txt +++ b/tests/legacy/022.txt @@ -32,6 +32,30 @@ IiANCg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "J�rgen Schm�rgen", + "address": "schmuergen@example.com" + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" + }, "date": { "DateTime": { "year": 2000, @@ -45,24 +69,6 @@ IiANCg== "tz_minute": 0 } }, - "content_transfer_encoding": { - "Text": "base64" - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" - }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "text", @@ -71,29 +77,23 @@ IiANCg== "charset": "iso-8859-1" } } - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "schmuergen@example.com" - } } }, "headers_other": { + "X-Priority": { + "Text": "3 (Normal)" + }, "X-MSMail-Priority": { "Text": "Normal" }, "X-Mailer": { "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, "Importance": { "Text": "Normal" }, - "X-Priority": { - "Text": "3 (Normal)" + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" } }, "headers_offsets": [ @@ -198,8 +198,7 @@ IiANCg== "parts": [ { "Text": { - "contents": "Die Hasen und die Frösche\r\n\r\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 selbst. Auf, laßt uns ein für allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\n", - "is_html": false + "body": "Die Hasen und die Frösche\r\n\r\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 selbst. Auf, laßt uns ein für allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\n" } } ], diff --git a/tests/legacy/023.txt b/tests/legacy/023.txt index 16bde11..154c234 100644 --- a/tests/legacy/023.txt +++ b/tests/legacy/023.txt @@ -110,26 +110,20 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716541962==_" - } - } - }, "to": { "Address": { "name": "Jürgen Schmürgen", "address": "jschmuergen@example.com" } }, - "message_id": { - "Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com" + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } }, "date": { "DateTime": { @@ -144,14 +138,20 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "tz_minute": 0 } }, - "subject": { - "Text": "Die Hasen und die Frösche" + "mime_version": { + "Text": "1.0" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "=====================_716541962==_" + } } + }, + "message_id": { + "Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com" } }, "headers_other": { @@ -234,20 +234,17 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - }, - { - "Attachment": 3 - } + 1, + 2, + 3 ], "parts": [ { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -256,18 +253,23 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } }, { "Binary": { "headers": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" }, @@ -278,18 +280,9 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "filename": "blueball.png" } } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1621,6 +1614,14 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Text": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "farmerandstork.txt" + } + } + }, "content_type": { "ContentType": { "c_type": "text", @@ -1629,30 +1630,16 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "charset": "us-ascii" } } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "farmerandstork.txt" - } - } } }, - "contents": "\r\nThe Farmer and the Stork \r\n \r\nA FARMER placed nets on his newly-sown plowlands and caught a\r\nnumber of Cranes, which came to pick up his seed. With them he\r\ntrapped a Stork that had fractured his leg in the net and was\r\nearnestly beseeching the Farmer to spare his life. \"Pray save\r\nme, Master,\" he said, \"and let me go free this once. My broken\r\nlimb should excite your pity. Besides, I am no Crane, I am a\r\nStork, a bird of excellent character; and see how I love and\r\nslave for my father and mother. Look too, at my feathers--\r\nthey are not the least like those of a Crane.\" The Farmer \r\nlaughed aloud and said, \"It may be all as you say, I only know \r\nthis: I have taken you with these robbers, the Cranes, and you \r\nmust die in their company.\" \r\n \r\nBirds of a feather flock together. \r\n\r", - "is_html": false + "body": "\r\nThe Farmer and the Stork \r\n \r\nA FARMER placed nets on his newly-sown plowlands and caught a\r\nnumber of Cranes, which came to pick up his seed. With them he\r\ntrapped a Stork that had fractured his leg in the net and was\r\nearnestly beseeching the Farmer to spare his life. \"Pray save\r\nme, Master,\" he said, \"and let me go free this once. My broken\r\nlimb should excite your pity. Besides, I am no Crane, I am a\r\nStork, a bird of excellent character; and see how I love and\r\nslave for my father and mother. Look too, at my feathers--\r\nthey are not the least like those of a Crane.\" The Farmer \r\nlaughed aloud and said, \"It may be all as you say, I only know \r\nthis: I have taken you with these robbers, the Cranes, and you \r\nmust die in their company.\" \r\n \r\nBirds of a feather flock together. \r\n\r" } }, { "Text": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "HasenundFr�sche.txt" - } - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, "content_type": { "ContentType": { @@ -1663,12 +1650,16 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= } } }, - "content_transfer_encoding": { - "Text": "quoted-printable" + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "HasenundFr�sche.txt" + } + } } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } } ], diff --git a/tests/legacy/024.txt b/tests/legacy/024.txt index 9d48c59..761a78e 100644 --- a/tests/legacy/024.txt +++ b/tests/legacy/024.txt @@ -111,16 +111,34 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715429112==_.REL", - "type": "text/html" + "type": "text/html", + "boundary": "=====================_715429112==_.REL" } } }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -134,37 +152,19 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "subject": { "Text": "Die Hasen und die Frösche" - }, - "message_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" - }, - "mime_version": { - "Text": "1.0" } }, "headers_other": { "X-Sender": { "Text": "dwsauder@pop.example.com (Unverified)" }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, "X-Priority": { "Text": "2 (High)" + }, + "X-Mailer": { + "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" } }, "headers_offsets": [ @@ -246,16 +246,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 1, + 2 ], "parts": [ { - "Text": { + "Html": { "headers": { "content_type": { "ContentType": { @@ -270,8 +266,7 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "Text": "quoted-printable" } }, - "contents": "\n\"2aa48eb6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\"2aa48ec0.png\"
\n", - "is_html": true + "body": "\n\"2aa48eb6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\"2aa48ec0.png\"
\n" } }, { @@ -280,14 +275,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "content_id": { "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa48eb6.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_disposition": { "ContentType": { @@ -297,11 +286,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa48eb6.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1633,18 +1628,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa48ec0.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1655,9 +1638,21 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== }, "content_transfer_encoding": { "Text": "base64" + }, + "content_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa48ec0.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/025.txt b/tests/legacy/025.txt index 3e34905..7ac2e23 100644 --- a/tests/legacy/025.txt +++ b/tests/legacy/025.txt @@ -173,6 +173,18 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -182,6 +194,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -194,38 +215,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" } }, "headers_other": { "X-Sender": { "Text": "dwsauder@pop.example.com (Unverified)" }, - "X-Priority": { - "Text": "2 (High)" - }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" + }, + "X-Priority": { + "Text": "2 (High)" } }, "headers_offsets": [ @@ -307,18 +307,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 1 ], "attachments": [ - { - "Attachment": 2 - }, - { - "Attachment": 3 - }, - { - "Attachment": 4 - }, - { - "Attachment": 5 - } + 2, + 3, + 4, + 5 ], "parts": [ { @@ -328,15 +320,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715462801==_.REL", - "type": "text/html" + "type": "text/html", + "boundary": "=====================_715462801==_.REL" } } } } }, { - "Text": { + "Html": { "headers": { "content_type": { "ContentType": { @@ -351,15 +343,20 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "Text": "quoted-printable" } }, - "contents": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\"2aa51367.png\"\"2aa51371.png\"\n", - "is_html": true + "body": "\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n
\"2aa51367.png\"\"2aa51371.png\"\n" } }, { "Binary": { "headers": { - "content_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa51367.png" + } + } }, "content_transfer_encoding": { "Text": "base64" @@ -372,17 +369,11 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa51367.png" - } - } + "content_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1723,6 +1714,12 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3" + }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1730,15 +1727,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "2aa51371.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.3" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3207,6 +3198,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -3214,12 +3208,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "blueball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -4551,9 +4542,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -4570,9 +4558,12 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/026.txt b/tests/legacy/026.txt index 6b4e804..3fc7959 100644 --- a/tests/legacy/026.txt +++ b/tests/legacy/026.txt @@ -86,27 +86,6 @@ Birds of a feather flock together. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -116,6 +95,15 @@ Birds of a feather flock together. } } }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "message_id": { + "Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com" + }, "date": { "DateTime": { "year": 2000, @@ -128,6 +116,18 @@ Birds of a feather flock together. "tz_hour": 4, "tz_minute": 0 } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "mime_version": { + "Text": "1.0" } }, "headers_other": { @@ -210,12 +210,8 @@ Birds of a feather flock together. 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 1, + 2 ], "parts": [ { @@ -234,13 +230,26 @@ Birds of a feather flock together. "Text": "quoted-printable" } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } }, { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "x-uuencode" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "name": "HasenundFr�sche.txt", + "x-mac-type": "54455854", + "x-mac-creator": "74747874" + } + } + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -248,24 +257,9 @@ Birds of a feather flock together. "filename": "HasenundFr�sche.txt" } } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "x-mac-creator": "74747874", - "name": "HasenundFr�sche.txt", - "x-mac-type": "54455854" - } - } - }, - "content_transfer_encoding": { - "Text": "x-uuencode" } }, - "contents": "\r\nbegin 600 HasenundFr�sche.txt\r\nM1&EE($AA\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue.  
\n
 
\n
\"blue
 
Slow but steady wins \nthe race. 
\n
 
\n
\"red
\n", - "is_html": true + "body": "\n\n\n\n\n

The Hare and the Tortoise
 
A HARE \none day ridiculed the short feet and slow pace of the Tortoise, who replied, \nlaughing:  \"Though you be swift as the wind, I will beat you in a \nrace.\"  The Hare, believing her assertion to be simply impossible, assented \nto the proposal; and they agreed that the Fox should choose the course and fix \nthe goal.  On the day appointed for the race the two started \ntogether.  The Tortoise never for a moment stopped, but went on with a slow \nbut steady pace straight to the end of the course.  The Hare, lying down by \nthe wayside, fell fast asleep.  At last waking up, and moving as fast as he \ncould, he saw the Tortoise had reached the goal, and was comfortably dozing \nafter her fatigue.  
\n
 
\n
\"blue
 
Slow but steady wins \nthe race. 
\n
 
\n
\"red
\n" } }, { @@ -379,6 +373,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "content_id": { "Text": "823504223@17052000-0f8d" }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -387,12 +384,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "blueball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1733,14 +1727,14 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_id": { - "Text": "823504223@17052000-0f94" - }, "content_transfer_encoding": { "Text": "base64" + }, + "content_id": { + "Text": "823504223@17052000-0f94" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/029.txt b/tests/legacy/029.txt index 9379fd0..713da3f 100644 --- a/tests/legacy/029.txt +++ b/tests/legacy/029.txt @@ -29,14 +29,8 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "message_id": { - "Text": "392362D8.B650789F@example.com" + "subject": { + "Text": "Test message from Netscape Communicator 4.7" }, "from": { "Address": { @@ -44,24 +38,6 @@ Slow but steady wins the race. "address": "dwsauder@example.com" } }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_transfer_encoding": { - "Text": "7bit" - }, "date": { "DateTime": { "year": 2000, @@ -74,17 +50,41 @@ Slow but steady wins the race. "tz_hour": 4, "tz_minute": 0 } + }, + "content_transfer_encoding": { + "Text": "7bit" + }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" + } + } + }, + "message_id": { + "Text": "392362D8.B650789F@example.com" } }, "headers_other": { "X-Priority": { "Text": "1 (Highest)" }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, "X-Accept-Language": { "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" } }, "headers_offsets": [ @@ -175,8 +175,7 @@ Slow but steady wins the race. "parts": [ { "Text": { - "contents": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r\n", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r\n" } } ], diff --git a/tests/legacy/030.txt b/tests/legacy/030.txt index 4037d58..6c2d85c 100644 --- a/tests/legacy/030.txt +++ b/tests/legacy/030.txt @@ -113,6 +113,12 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, "message_id": { "Text": "3923635B.85C58444@example.com" }, @@ -125,18 +131,18 @@ Slow but steady wins the race. } } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "to": { "Address": { "name": "Joe Blow", "address": "blow@example.com" } }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "mime_version": { + "Text": "1.0" + }, "date": { "DateTime": { "year": 2000, @@ -149,12 +155,6 @@ Slow but steady wins the race. "tz_hour": 4, "tz_minute": 0 } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" } }, "headers_other": { @@ -241,20 +241,17 @@ Slow but steady wins the race. 2 ], "attachments": [ - { - "Inline": 1 - }, - { - "Inline": 2 - }, - { - "Attachment": 3 - } + 1, + 2, + 3 ], "parts": [ { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -263,21 +260,14 @@ Slow but steady wins the race. "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "contents": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r" } }, { - "Binary": { + "InlineBinary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -294,9 +284,12 @@ Slow but steady wins the race. "name": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1626,7 +1619,7 @@ Slow but steady wins the race. } }, { - "Binary": { + "InlineBinary": { "headers": { "content_type": { "ContentType": { @@ -1649,7 +1642,7 @@ Slow but steady wins the race. "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -2954,6 +2947,9 @@ Slow but steady wins the race. { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -2964,9 +2960,6 @@ Slow but steady wins the race. } } }, - "content_transfer_encoding": { - "Text": "7bit" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -2976,8 +2969,7 @@ Slow but steady wins the race. } } }, - "contents": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race. \r\n\r", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race. \r\n\r" } } ], diff --git a/tests/legacy/031.txt b/tests/legacy/031.txt index 7a08a0b..8dc587e 100644 --- a/tests/legacy/031.txt +++ b/tests/legacy/031.txt @@ -98,14 +98,20 @@ Z3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" + } + }, + "subject": { + "Text": "Test message from PINE" }, "message_id": { "Text": "Pine.LNX.4.21.0005190951410.8452-102000@penguin.example.com" }, - "subject": { - "Text": "Test message from PINE" + "mime_version": { + "Text": "1.0" }, "content_type": { "ContentType": { @@ -116,12 +122,6 @@ Z3VldDZzO7wAAAAASUVORK5CYII= } } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -200,12 +200,8 @@ Z3VldDZzO7wAAAAASUVORK5CYII= 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 1, + 2 ], "parts": [ { @@ -221,19 +217,12 @@ Z3VldDZzO7wAAAAASUVORK5CYII= } } }, - "contents": "This is a test message from PINE MUA.\r\n\r\n\r", - "is_html": false + "body": "This is a test message from PINE MUA.\r\n\r\n\r" } }, { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "BASE64" - }, - "content_id": { - "Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com" - }, "content_type": { "ContentType": { "c_type": "application", @@ -243,9 +232,6 @@ Z3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_description": { - "Text": "A PNG graphic file" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -253,9 +239,18 @@ Z3VldDZzO7wAAAAASUVORK5CYII= "filename": "redball.png" } } + }, + "content_transfer_encoding": { + "Text": "BASE64" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005190955480.8452@penguin.example.com" + }, + "content_description": { + "Text": "A PNG graphic file" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1724,15 +1719,15 @@ Z3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_id": { + "Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com" + }, "content_transfer_encoding": { "Text": "BASE64" }, "content_description": { "Text": "A PNG graphic file" }, - "content_id": { - "Text": "Pine.LNX.4.21.0005190955481.8452@penguin.example.com" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1742,7 +1737,7 @@ Z3VldDZzO7wAAAAASUVORK5CYII= } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/032.txt b/tests/legacy/032.txt index 0c9dbc1..4e67566 100644 --- a/tests/legacy/032.txt +++ b/tests/legacy/032.txt @@ -135,18 +135,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "message_id": { - "Text": "39235EAD.E48E2160@example.com" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -156,15 +144,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, "date": { "DateTime": { "year": 2000, @@ -177,6 +156,27 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "39235EAD.E48E2160@example.com" } }, "headers_other": { @@ -263,12 +263,8 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 4 ], "attachments": [ - { - "Inline": 3 - }, - { - "Inline": 4 - } + 3, + 4 ], "parts": [ { @@ -300,12 +296,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "contents": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n", - "is_html": false + "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n" } }, { - "Text": { + "Html": { "headers": { "content_transfer_encoding": { "Text": "7bit" @@ -320,16 +315,12 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "contents": "\r\n\r\nDie Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
 \r\n
 \r\n\r", - "is_html": true + "body": "\r\n\r\nDie Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
 \r\n
 \r\n\r" } }, { - "Binary": { + "InlineBinary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -346,9 +337,12 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1651,8 +1645,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } }, { - "Binary": { + "InlineBinary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1669,12 +1666,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "blueball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/033.txt b/tests/legacy/033.txt index 9bbfc59..a84c5d3 100644 --- a/tests/legacy/033.txt +++ b/tests/legacy/033.txt @@ -38,21 +38,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "message_id": { "Text": "392363E1.2AC47AB3@example.com" }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "content_type": { "ContentType": { "c_type": "text", @@ -62,8 +47,11 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." } } }, - "mime_version": { - "Text": "1.0" + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } }, "date": { "DateTime": { @@ -80,17 +68,29 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." }, "subject": { "Text": "Test message from Netscape Communicator 4.7" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } } }, "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" + "X-Accept-Language": { + "Text": "en" }, "X-Priority": { "Text": "5 (Lowest)" }, - "X-Accept-Language": { - "Text": "en" + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" } }, "headers_offsets": [ @@ -181,8 +181,7 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "parts": [ { "Text": { - "contents": "Die Hasen und die Fr�sche\n\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der\nTod selbst. Auf, la�t uns ein f�r allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt\nerschreckte eine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs\nschnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\n", - "is_html": false + "body": "Die Hasen und die Fr�sche\n\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der\nTod selbst. Auf, la�t uns ein f�r allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt\nerschreckte eine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs\nschnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\n" } } ], diff --git a/tests/legacy/034.txt b/tests/legacy/034.txt index 683eb16..0f48b03 100644 --- a/tests/legacy/034.txt +++ b/tests/legacy/034.txt @@ -28,15 +28,6 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-7" - } - } - }, "date": { "DateTime": { "year": 2000, @@ -50,29 +41,38 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." "tz_minute": 0 } }, - "to": { - "Address": { - "name": "Heinz M+APw-ller", - "address": "mueller@example.com" - } - }, - "content_transfer_encoding": { - "Text": "7bit" - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-7" + } + } + }, + "to": { + "Address": { + "name": "Heinz M+APw-ller", + "address": "mueller@example.com" + } + }, "mime_version": { "Text": "1.0" }, - "message_id": { - "Text": "39236497.12FA2A89@example.com" - }, "subject": { "Text": "Die Hasen und die Fr+APY-sche" + }, + "content_transfer_encoding": { + "Text": "7bit" + }, + "message_id": { + "Text": "39236497.12FA2A89@example.com" } }, "headers_other": { @@ -164,8 +164,7 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." "parts": [ { "Text": { - "contents": "Die Hasen und die Fr岣he\r\n\r\nDie Hasen klagten einst 롥r ihre miެiche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\r\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist 㱧er als der\r\nTod selbst. Auf, la޴ uns ein f밠allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ers㴦en; sie eilten ihm zu;\r\nallein das auޥrordentliche Get岥 und ihre wunderbare Gestalt\r\nerschreckte eine Menge Fr岣he, die am Ufer saޥn, so sehr, daݠsie aufs\r\nschnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers㴦en noch ein\r\nwenig aufschieben, denn auch uns f뱣hten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl뢫licher sein m벳en als wir.\"\r\n", - "is_html": false + "body": "Die Hasen und die Fr岣he\r\n\r\nDie Hasen klagten einst 롥r ihre miެiche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\r\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist 㱧er als der\r\nTod selbst. Auf, la޴ uns ein f밠allemal sterben.\" \r\n\r\nIn einem nahen Teich wollten sie sich nun ers㴦en; sie eilten ihm zu;\r\nallein das auޥrordentliche Get岥 und ihre wunderbare Gestalt\r\nerschreckte eine Menge Fr岣he, die am Ufer saޥn, so sehr, daݠsie aufs\r\nschnellste untertauchten. \r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers㴦en noch ein\r\nwenig aufschieben, denn auch uns f뱣hten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl뢫licher sein m벳en als wir.\"\r\n" } } ], diff --git a/tests/legacy/035.txt b/tests/legacy/035.txt index 66f677a..d449d8f 100644 --- a/tests/legacy/035.txt +++ b/tests/legacy/035.txt @@ -214,18 +214,6 @@ YII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "39235FC5.276CCE00@example.com" - }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -235,6 +223,15 @@ YII= } } }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, "date": { "DateTime": { "year": 2000, @@ -248,14 +245,17 @@ YII= "tz_minute": 0 } }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)" - }, "to": { "Address": { "name": "Heinz Müller", "address": "mueller@example.com" } + }, + "message_id": { + "Text": "39235FC5.276CCE00@example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)" } }, "headers_other": { @@ -342,18 +342,10 @@ YII= 7 ], "attachments": [ - { - "Attachment": 4 - }, - { - "Attachment": 5 - }, - { - "Inline": 6 - }, - { - "Inline": 7 - } + 4, + 5, + 6, + 7 ], "parts": [ { @@ -385,8 +377,7 @@ YII= "Text": "quoted-printable" } }, - "contents": "[blue ball]\n\nDie Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n[Image]\n\n\n", - "is_html": false + "body": "[blue ball]\n\nDie Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n[Image]\n\n\n" } }, { @@ -403,7 +394,7 @@ YII= } }, { - "Text": { + "Html": { "headers": { "content_type": { "ContentType": { @@ -418,13 +409,21 @@ YII= "Text": "7bit" } }, - "contents": "\r\n\r\n\"blue\r\n

Die Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n

\r\n
 \r\n
 \r\n\r", - "is_html": true + "body": "\r\n\r\n\"blue\r\n

Die Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n

\r\n
 \r\n
 \r\n\r" } }, { "Binary": { "headers": { + "content_id": { + "Text": "part1.39235FC5.E71D8178@example.com" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png" + } + }, "content_transfer_encoding": { "Text": "base64" }, @@ -435,18 +434,9 @@ YII= "filename": "C:TEMPnsmailEG.png" } } - }, - "content_id": { - "Text": "part1.39235FC5.E71D8178@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png" - } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1784,9 +1774,6 @@ YII= "c_subtype": "png" } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1797,9 +1784,12 @@ YII= }, "content_id": { "Text": "part2.39235FC5.E71D8178@example.com" + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3257,8 +3247,11 @@ YII= } }, { - "Binary": { + "InlineBinary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -3268,9 +3261,6 @@ YII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -3280,7 +3270,7 @@ YII= } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -4738,8 +4728,16 @@ YII= } }, { - "Binary": { + "InlineBinary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" + } + } + }, "content_type": { "ContentType": { "c_type": "image", @@ -4749,19 +4747,11 @@ YII= } } }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/036.txt b/tests/legacy/036.txt index 21f26b7..e324517 100644 --- a/tests/legacy/036.txt +++ b/tests/legacy/036.txt @@ -28,11 +28,8 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } + "message_id": { + "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com" }, "date": { "DateTime": { @@ -47,17 +44,8 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com" - }, - "mime_version": { - "Text": "1.0" + "content_transfer_encoding": { + "Text": "QUOTED-PRINTABLE" }, "subject": { "Text": "Die Hasen und die Frösche" @@ -71,8 +59,20 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 } } }, - "content_transfer_encoding": { - "Text": "QUOTED-PRINTABLE" + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" + } } }, "headers_offsets": [ @@ -142,8 +142,7 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n\n" } } ], diff --git a/tests/legacy/037.txt b/tests/legacy/037.txt index 7b860cd..d6acd57 100644 --- a/tests/legacy/037.txt +++ b/tests/legacy/037.txt @@ -53,6 +53,30 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------E7889DDF0F75D34163841C59" + } + } + }, "date": { "DateTime": { "year": 2000, @@ -66,35 +90,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" + "mime_version": { + "Text": "1.0" }, "message_id": { "Text": "392366A7.21929EA7@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------E7889DDF0F75D34163841C59" - } - } - }, - "mime_version": { - "Text": "1.0" } }, "headers_other": { @@ -179,14 +179,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 1 ], "attachments": [ - { - "Inline": 1 - } + 1 ], "parts": [ { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -195,17 +196,13 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "contents": " \r", - "is_html": false + "body": " \r" } }, { - "Binary": { + "InlineBinary": { "headers": { "content_transfer_encoding": { "Text": "base64" @@ -228,7 +225,7 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/038.txt b/tests/legacy/038.txt index 778ad0b..52acce7 100644 --- a/tests/legacy/038.txt +++ b/tests/legacy/038.txt @@ -19,17 +19,29 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "3923625B.59F0C3AC@example.com" + }, + "content_transfer_encoding": { + "Text": "7bit" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, "subject": { "Text": "Test message from Netscape Communicator 4.7" }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } + "mime_version": { + "Text": "1.0" }, "date": { "DateTime": { @@ -44,34 +56,22 @@ Slow but steady wins the race. "tz_minute": 0 } }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" + } } - }, - "content_transfer_encoding": { - "Text": "7bit" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "3923625B.59F0C3AC@example.com" - }, - "mime_version": { - "Text": "1.0" } }, "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, "X-Accept-Language": { "Text": "en" + }, + "X-Mailer": { + "Text": "Mozilla 4.7 [en] (WinNT; I)" } }, "headers_offsets": [ @@ -155,8 +155,7 @@ Slow but steady wins the race. "parts": [ { "Text": { - "contents": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race.\r\n", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\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, 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. \r\n \r\nSlow but steady wins the race.\r\n" } } ], diff --git a/tests/legacy/039.txt b/tests/legacy/039.txt index 970f85d..033adac 100644 --- a/tests/legacy/039.txt +++ b/tests/legacy/039.txt @@ -173,18 +173,36 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "39236103.FFE674FC@example.com" - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------B7133A01A6B323BF00DBC9A7" + } + } + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "message_id": { + "Text": "39236103.FFE674FC@example.com" + }, "mime_version": { "Text": "1.0" }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -197,32 +215,14 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------B7133A01A6B323BF00DBC9A7" - } - } } }, "headers_other": { - "X-Accept-Language": { - "Text": "en" - }, "X-Mailer": { "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" } }, "headers_offsets": [ @@ -301,18 +301,10 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 5 ], "attachments": [ - { - "Attachment": 2 - }, - { - "Attachment": 3 - }, - { - "Inline": 4 - }, - { - "Inline": 5 - } + 2, + 3, + 4, + 5 ], "parts": [ { @@ -329,7 +321,7 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } }, { - "Text": { + "Html": { "headers": { "content_transfer_encoding": { "Text": "7bit" @@ -344,13 +336,23 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "contents": "\r\n\r\n\"blue\r\n

Die Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n

\"red\r\n\r", - "is_html": true + "body": "\r\n\r\n\"blue\r\n

Die Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n

\"red\r\n\r" } }, { "Binary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "C:TEMPnsmailV0.png" + } + } + }, + "content_id": { + "Text": "part1.39236103.1B697A54@example.com" + }, "content_transfer_encoding": { "Text": "base64" }, @@ -359,20 +361,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "image", "c_subtype": "png" } - }, - "content_id": { - "Text": "part1.39236103.1B697A54@example.com" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "C:TEMPnsmailV0.png" - } - } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1704,8 +1695,8 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_id": { - "Text": "part2.39236103.1B697A54@example.com" + "content_transfer_encoding": { + "Text": "base64" }, "content_disposition": { "ContentType": { @@ -1715,8 +1706,8 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_id": { + "Text": "part2.39236103.1B697A54@example.com" }, "content_type": { "ContentType": { @@ -1725,7 +1716,7 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3183,16 +3174,8 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } }, { - "Binary": { + "InlineBinary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" }, @@ -3204,9 +3187,17 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -4509,10 +4500,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } }, { - "Binary": { + "InlineBinary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" + } + } }, "content_type": { "ContentType": { @@ -4523,16 +4519,11 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/040.txt b/tests/legacy/040.txt index 96ac9c9..049d952 100644 --- a/tests/legacy/040.txt +++ b/tests/legacy/040.txt @@ -30,15 +30,6 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "39236653.CAA8A090@example.com" - }, "content_type": { "ContentType": { "c_type": "text", @@ -48,8 +39,14 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= } } }, - "content_transfer_encoding": { - "Text": "quoted-printable" + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } }, "to": { "Address": { @@ -57,11 +54,11 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "address": "schmuergen@example.com" } }, - "mime_version": { - "Text": "1.0" + "message_id": { + "Text": "39236653.CAA8A090@example.com" }, - "subject": { - "Text": "Die Hasen und die Frösche" + "content_transfer_encoding": { + "Text": "quoted-printable" }, "date": { "DateTime": { @@ -75,6 +72,9 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "tz_hour": 4, "tz_minute": 0 } + }, + "subject": { + "Text": "Die Hasen und die Frösche" } }, "headers_other": { @@ -166,8 +166,7 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\"\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\"\n" } } ], diff --git a/tests/legacy/041.txt b/tests/legacy/041.txt index 8fdfcfb..7f2c14f 100644 --- a/tests/legacy/041.txt +++ b/tests/legacy/041.txt @@ -59,15 +59,6 @@ vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191019440.8452-101000@penguin.example.com" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -77,9 +68,27 @@ vAAAAABJRU5ErkJggg== } } }, + "subject": { + "Text": "PNG graphic" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" + } + }, "mime_version": { "Text": "1.0" }, + "message_id": { + "Text": "Pine.LNX.4.21.0005191019440.8452-101000@penguin.example.com" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -92,15 +101,6 @@ vAAAAABJRU5ErkJggg== "tz_hour": 4, "tz_minute": 0 } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, - "subject": { - "Text": "PNG graphic" } }, "headers_offsets": [ @@ -161,9 +161,7 @@ vAAAAABJRU5ErkJggg== 0 ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { @@ -179,29 +177,20 @@ vAAAAABJRU5ErkJggg== } } }, - "contents": "\r", - "is_html": false + "body": "\r" } }, { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "BASE64" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "attributes": { - "filename": "redball.png" - } - } + "content_id": { + "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com" }, "content_description": { "Text": "red ball" }, - "content_id": { - "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com" + "content_transfer_encoding": { + "Text": "BASE64" }, "content_type": { "ContentType": { @@ -211,9 +200,17 @@ vAAAAABJRU5ErkJggg== "name": "redball.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "attributes": { + "filename": "redball.png" + } + } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/042.txt b/tests/legacy/042.txt index 8ec4378..4d0f093 100644 --- a/tests/legacy/042.txt +++ b/tests/legacy/042.txt @@ -73,8 +73,14 @@ Birds of a feather flock together. "tz_minute": 0 } }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } }, "content_type": { "ContentType": { @@ -85,31 +91,25 @@ Birds of a feather flock together. } } }, + "message_id": { + "Text": "3923686C.99FB5E36@example.com" + }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, - "message_id": { - "Text": "3923686C.99FB5E36@example.com" - }, - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } + "subject": { + "Text": "Test message from Netscape Communicator 4.7" } }, "headers_other": { - "X-Accept-Language": { - "Text": "en" - }, "X-Mailer": { "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" } }, "headers_offsets": [ @@ -184,14 +184,15 @@ Birds of a feather flock together. 0 ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -200,28 +201,14 @@ Birds of a feather flock together. "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "contents": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r" } }, { "Text": { "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii", - "name": "farmerandstork.txt" - } - } - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -232,10 +219,19 @@ Birds of a feather flock together. }, "content_transfer_encoding": { "Text": "7bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii", + "name": "farmerandstork.txt" + } + } } }, - "contents": "\r\nThe Farmer and the Stork \r\n \r\nA FARMER placed nets on his newly-sown plowlands and caught a\r\nnumber of Cranes, which came to pick up his seed. With them he\r\ntrapped a Stork that had fractured his leg in the net and was\r\nearnestly beseeching the Farmer to spare his life. \"Pray save\r\nme, Master,\" he said, \"and let me go free this once. My broken\r\nlimb should excite your pity. Besides, I am no Crane, I am a\r\nStork, a bird of excellent character; and see how I love and\r\nslave for my father and mother. Look too, at my feathers--\r\nthey are not the least like those of a Crane.\" The Farmer \r\nlaughed aloud and said, \"It may be all as you say, I only know \r\nthis: I have taken you with these robbers, the Cranes, and you \r\nmust die in their company.\" \r\n \r\nBirds of a feather flock together. \r\n\r", - "is_html": false + "body": "\r\nThe Farmer and the Stork \r\n \r\nA FARMER placed nets on his newly-sown plowlands and caught a\r\nnumber of Cranes, which came to pick up his seed. With them he\r\ntrapped a Stork that had fractured his leg in the net and was\r\nearnestly beseeching the Farmer to spare his life. \"Pray save\r\nme, Master,\" he said, \"and let me go free this once. My broken\r\nlimb should excite your pity. Besides, I am no Crane, I am a\r\nStork, a bird of excellent character; and see how I love and\r\nslave for my father and mother. Look too, at my feathers--\r\nthey are not the least like those of a Crane.\" The Farmer \r\nlaughed aloud and said, \"It may be all as you say, I only know \r\nthis: I have taken you with these robbers, the Cranes, and you \r\nmust die in their company.\" \r\n \r\nBirds of a feather flock together. \r\n\r" } } ], diff --git a/tests/legacy/043.txt b/tests/legacy/043.txt index fcd8c4e..9569f0b 100644 --- a/tests/legacy/043.txt +++ b/tests/legacy/043.txt @@ -63,9 +63,6 @@ als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, "message_id": { "Text": "392359CF.DFF4527@example.com" }, @@ -75,6 +72,9 @@ als wir." "address": "mueller@example.com" } }, + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" + }, "date": { "DateTime": { "year": 2000, @@ -88,15 +88,15 @@ als wir." "tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -190,9 +190,6 @@ als wir." { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -201,18 +198,17 @@ als wir." "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n", - "is_html": false + "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n" } }, { - "Text": { + "Html": { "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -221,10 +217,12 @@ als wir." "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, - "contents": "\r\n\r\nDie Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
 \r\n
 \r\n\r", - "is_html": true + "body": "\r\n\r\nDie Hasen und die Frösche\r\n

Die Hasen klagten einst über ihre mißliche Lage; \"wir leben\",\r\nsprach ein Redner, \"in steter Furcht vor Menschen und Tieren, eine Beute\r\nder Hunde, der Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger\r\nals der Tod selbst. Auf, laßt uns ein für allemal sterben.\"\r\n

In einem nahen Teich wollten sie sich nun ersäufen; sie eilten\r\nihm zu; allein das außerordentliche Getöse und ihre wunderbare\r\nGestalt erschreckte eine Menge Frösche, die am Ufer saßen, so\r\nsehr, daß sie aufs schnellste untertauchten.\r\n

\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen\r\nnoch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht,\r\neinige Tiere, welche also wohl noch unglücklicher sein müssen\r\nals wir.\"\r\n
 \r\n
 \r\n\r" } } ], diff --git a/tests/legacy/044.txt b/tests/legacy/044.txt index e945509..3dcb383 100644 --- a/tests/legacy/044.txt +++ b/tests/legacy/044.txt @@ -142,12 +142,27 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "message_id": { "Text": "39235E1C.1DC7EA90@example.com" }, + "mime_version": { + "Text": "1.0" + }, "to": { "Address": { "name": "Joe Blow", "address": "blow@example.com" } }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------A1FCDEE154E03D875E5D6779" + } + } + }, "from": { "Address": { "name": "Doug Sauder", @@ -166,29 +181,14 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------A1FCDEE154E03D875E5D6779" - } - } } }, "headers_other": { - "X-Accept-Language": { - "Text": "en" - }, "X-Mailer": { "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" } }, "headers_offsets": [ @@ -269,20 +269,17 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 3 ], "attachments": [ - { - "Inline": 1 - }, - { - "Inline": 2 - }, - { - "Inline": 3 - } + 1, + 2, + 3 ], "parts": [ { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -291,18 +288,17 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "contents": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n", - "is_html": false + "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n" } }, { - "Binary": { + "InlineBinary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -319,12 +315,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "redball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1782,11 +1775,19 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } }, { - "Binary": { + "InlineBinary": { "headers": { "content_transfer_encoding": { "Text": "base64" }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "greenball.png" + } + } + }, "content_type": { "ContentType": { "c_type": "image", @@ -1795,17 +1796,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "greenball.png" - } - } } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3108,8 +3101,19 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } }, { - "Binary": { + "InlineBinary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "blueball.png" + } + } + }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -3118,20 +3122,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "blueball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "blueball.png" - } - } } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/045.txt b/tests/legacy/045.txt index dd13df6..5a90d17 100644 --- a/tests/legacy/045.txt +++ b/tests/legacy/045.txt @@ -44,27 +44,21 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-891160829-958746372=:8452" + "to": { + "AddressList": [ + { + "name": "Joe Blow", + "address": "blow@example.com" + }, + { + "name": "Heinz Müller", + "address": "mueller@example.com" } - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" + ] }, "mime_version": { "Text": "1.0" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@penguin.example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -78,20 +72,26 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= "tz_minute": 0 } }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@penguin.example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, "message_id": { "Text": "Pine.LNX.4.21.0005191024380.8452-200000@penguin.example.com" }, - "to": { - "AddressList": [ - { - "name": "Joe Blow", - "address": "blow@example.com" - }, - { - "name": "Heinz Müller", - "address": "mueller@example.com" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "-1463757054-891160829-958746372=:8452" } - ] + } } }, "headers_offsets": [ @@ -152,9 +152,7 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= 0 ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { @@ -170,8 +168,7 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= } } }, - "contents": "\r", - "is_html": false + "body": "\r" } }, { @@ -182,11 +179,17 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= "c_type": "text", "c_subtype": "plain", "attributes": { - "charset": "iso-8859-1", - "name": "HasenundFrösche.txt" + "name": "HasenundFrösche.txt", + "charset": "iso-8859-1" } } }, + "content_description": { + "Text": "Short story in German" + }, + "content_transfer_encoding": { + "Text": "BASE64" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -195,18 +198,11 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= } } }, - "content_transfer_encoding": { - "Text": "BASE64" - }, "content_id": { "Text": "Pine.LNX.4.21.0005191026120.8452@penguin.example.com" - }, - "content_description": { - "Text": "Short story in German" } }, - "contents": "Die Hasen und die Frösche\r\r\n\r\r\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 selbst. Auf, laßt uns ein für allemal sterben.\" \r\r\n\r\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\r\n\r\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\r\n\r\r\n", - "is_html": false + "body": "Die Hasen und die Frösche\r\r\n\r\r\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 selbst. Auf, laßt uns ein für allemal sterben.\" \r\r\n\r\r\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \r\r\n\r\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \r\r\n\r\r\n" } } ], diff --git a/tests/legacy/046.txt b/tests/legacy/046.txt index 6d0c2ba..e68ec42 100644 --- a/tests/legacy/046.txt +++ b/tests/legacy/046.txt @@ -34,10 +34,10 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { + "from": { "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, "content_transfer_encoding": { @@ -56,9 +56,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "text", @@ -68,17 +65,20 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." } } }, - "from": { + "to": { "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" } }, - "message_id": { - "Text": "3923561C.B7078DEF@example.com" + "mime_version": { + "Text": "1.0" }, "subject": { "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" + }, + "message_id": { + "Text": "3923561C.B7078DEF@example.com" } }, "headers_other": { @@ -170,8 +170,7 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "parts": [ { "Text": { - "contents": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n", - "is_html": false + "body": "Die Hasen und die Frösche\n\nDie Hasen klagten einst über ihre mißliche Lage; \"wir leben\", sprach ein\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde,\nder Adler, ja fast aller Raubtiere! Unsere stete Angst ist ärger als der\nTod selbst. Auf, laßt uns ein für allemal sterben.\"\n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.\n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein\nwenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere,\nwelche also wohl noch unglücklicher sein müssen als wir.\"\n\n\n" } } ], diff --git a/tests/legacy/047.txt b/tests/legacy/047.txt index 7e074d8..9a77248 100644 --- a/tests/legacy/047.txt +++ b/tests/legacy/047.txt @@ -62,6 +62,33 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------CA611088711119FBDB3473B4" + } + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "392367BC.3D075C95@example.com" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -75,43 +102,16 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "message_id": { - "Text": "392367BC.3D075C95@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, "subject": { "Text": "Test message from Netscape Communicator 4.7" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------CA611088711119FBDB3473B4" - } - } } }, "headers_other": { - "X-Accept-Language": { - "Text": "en" - }, "X-Mailer": { "Text": "Mozilla 4.7 [en] (WinNT; I)" + }, + "X-Accept-Language": { + "Text": "en" } }, "headers_offsets": [ @@ -186,9 +186,7 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= 0 ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { @@ -207,8 +205,7 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "Text": "7bit" } }, - "contents": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r" } }, { @@ -236,8 +233,7 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= } } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n" } } ], diff --git a/tests/legacy/048.txt b/tests/legacy/048.txt index bbc1132..bef7d1a 100644 --- a/tests/legacy/048.txt +++ b/tests/legacy/048.txt @@ -157,6 +157,30 @@ end ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------177483472E7788F4AD46AB1A" + } + } + }, + "message_id": { + "Text": "3923670C.67D83A99@example.com" + }, "date": { "DateTime": { "year": 2000, @@ -170,30 +194,6 @@ end "tz_minute": 0 } }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------177483472E7788F4AD46AB1A" - } - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "3923670C.67D83A99@example.com" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, "from": { "Address": { "name": "Doug Sauder", @@ -287,20 +287,17 @@ end 3 ], "attachments": [ - { - "Inline": 1 - }, - { - "Inline": 2 - }, - { - "Inline": 3 - } + 1, + 2, + 3 ], "parts": [ { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -309,27 +306,14 @@ end "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, - "contents": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r", - "is_html": false + "body": "\r\nThe Hare and the Tortoise \r\n \r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise,\r\nwho replied, laughing: \"Though you be swift as the wind, I will beat\r\nyou in a race.\" The Hare, believing her assertion to be simply\r\nimpossible, assented to the proposal; and they agreed that the Fox\r\nshould choose the course and fix the goal. On the day appointed for the\r\nrace the two started together. The Tortoise never for a moment stopped,\r\nbut went on with a slow but steady pace straight to the end of the\r\ncourse. The Hare, lying down by the wayside, fell fast asleep. At last\r\nwaking up, and moving as fast as he could, he saw the Tortoise had\r\nreached the goal, and was comfortably dozing after her fatigue. \r\n \r\nSlow but steady wins the race.\r" } }, { - "Binary": { + "InlineBinary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, "content_transfer_encoding": { "Text": "x-uuencode" }, @@ -340,9 +324,18 @@ end "filename": "redball.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } } }, - "contents": [ + "body": [ 98, 101, 103, @@ -2415,8 +2408,17 @@ end } }, { - "Binary": { + "InlineBinary": { "headers": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } + } + }, "content_transfer_encoding": { "Text": "x-uuencode" }, @@ -2427,18 +2429,9 @@ end "filename": "greenball.png" } } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } } }, - "contents": [ + "body": [ 98, 101, 103, @@ -4293,7 +4286,7 @@ end } }, { - "Binary": { + "InlineBinary": { "headers": { "content_transfer_encoding": { "Text": "x-uuencode" @@ -4316,7 +4309,7 @@ end } } }, - "contents": [ + "body": [ 98, 101, 103, diff --git a/tests/legacy/049.txt b/tests/legacy/049.txt index 9ddca14..f0f4b40 100644 --- a/tests/legacy/049.txt +++ b/tests/legacy/049.txt @@ -133,15 +133,6 @@ end ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com" - }, "subject": { "Text": "Test message from Microsoft Outlook 00" }, @@ -163,15 +154,24 @@ end "tz_hour": 4, "tz_minute": 0 } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } } }, "headers_other": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, "X-Priority": { "Text": "3 (Normal)" }, + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + }, "X-MSMail-Priority": { "Text": "Normal" }, @@ -263,8 +263,7 @@ end "parts": [ { "Text": { - "contents": "\r\nThe Hare and the Tortoise\r\n\r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who\r\nreplied, laughing: \"Though you be swift as the wind, I will beat you in a\r\nrace.\" The Hare, believing her assertion to be simply impossible, assented\r\nto the proposal; and they agreed that the Fox should choose the course and\r\nfix the goal. On the day appointed for the race the two started together.\r\nThe Tortoise never for a moment stopped, but went on with a slow but steady\r\npace straight to the end of the course. The Hare, lying down by the\r\nwayside, fell fast asleep. At last waking up, and moving as fast as he\r\ncould, he saw the Tortoise had reached the goal, and was comfortably dozing\r\nafter her fatigue.\r\n\r\nSlow but steady wins the race.\r\n\r\n\r\nbegin 666 blueball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM``@``! ``!@`````\"\"D`$$(`$$H`\"#$`$%(((7,(*7L(*80((6L`&%H`\"#D(\r\nM(6,0.9P80J480JT80K40.:40,90`&%(0,8PI4K4Y8\\8Y8\\XI6LX82LX80LX8\r\nM0KU\":\\9[G-:\\ZMSMZESN]:C.\\0,9Q:A-:MUN?.[^^,O>]*>^\\8.:482L:,\r\nMO>>UY^^4O>\\``\"E:C.=SI>]KG.\\(*8PQ8^\\I6N\\((7L`````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#!\r\nM,@U5`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```&(241!5'B<==)M5YLP& ;@$DZ )A!2DX;,\"4RG!2+:JHO;K&_;\r\nM?/G_ORA[TE;LL<>;+YQSG3LAY!F-A@0H1\"APHYT$.(HA48+#CXS'A*80DK$H\r\nM0=OHT(*,54I*9+0#>J23(LO^U\\/RJJ64PV(!L1,[WT[//I^?#)K6MGI\r\nM+#)O>P8QG>P?GO:G9^?SIFP7BC\"\\*;J$:W%QV??]U8]Y4]7\"4I:#>0PB,I'7\r\nM/_O^U^^;65/60H&%:PMCNKR]OKN_?_\"U5B[>S3T66I0'?_[^N_&[U:+3A*_,\r\nMC1QF3Z*=S9]?&D]R:M,L3@9+EW75@%1 \"ZLIC_UW>GLLJ)5M65:W-=!2:<+\\\r\nM^59F8J*F==U\"28H.B,.2&PMSEJJE%%(N.JOT:U9$9K4D6(\"++%6VZZRU*O6$\r\nMUS5_B# 'U$HIG5+\"BR@9\"(HF'W-\"*7TEG(^!UBNNS\"&3QP7CG#.X=[-I;7XV\r\nM8))'D!PF`FV3QP`9@XT)W^7M;OUK@. 9P&T-Q6ZVI^E3^8B[X[L#_P$45,S8\r\nMF6D.OP```\"5T15AT0V]M;65N= !C;&EP,F=I9B!V+C N-B!B>2!9=F5S(%!I\r\n49W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 greenball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM````$ ``& ``(0``\" ``,0``0@``4@``6@``2@`(8P`(P`0C `(:P``\r\nM.0``8P`0E `0G `AI0`0I0`AK0!\"O1ACQC%CQCE2QB$IS@`8O0`0K0`8K0`A\r\nMO0\"4UF.MUGN$UE)*WA@AU@`8Q@`8M0``*0!\"SA#.YY3>YZW&YY24YV-2YR$A\r\nMW@`8S@!2WB&KRU;5>]/60`]SX,0^'\\8HC[&`29]Y('?:!&F+.2<\r\nMAR(@R.NVVF@02C4<#N-8#:LMN[^]G#XU-FDB)VC_PW8#K614(E9K+_6\\Z7)DR)5\r\nM&]$:$C(QV7R9F9)&BH>4:+^V`8\\38\\HF1ZGD+*AN[TSC4*5)7LIWJN2V#52)\r\nM6-AWSS)*\"R>Q(T9Q!/W:?$T$ERJ.E9)RP\\KW!$V2%B)\"RQ XWX2\"D@ZY1A=>\r\nM0!EC0M\"@W]+6K ]T1##&U$6K84.VWA,`-4*11EZU$YV]<1^^#V&Y+*TTV=K_\r\nMJK>-T@@L+ ```\"5T15AT0V]M;65N= !C;&EP,F=I\r\nF9B!V+C N-B!B>2!9=F5S(%!I9W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 redball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM```!```+```5```:```7```1```*```#```<```R``!$``!-``!(```]```C\r\nM```6```F``!A``![``\"&``\"'``!]``!T``!@```Y```4```&```G``!+``!O\r\nM``\"0``\"E``\"[``\"_``\"K``\"A``\",``!S``!;```N```(``!,``!W``\"9``\"T\r\nM&1G*.#C5/3W;*2G=!06X``\"H``!Y```Q```8```$``!%``\":``\"[)\"3186'?\r\nMA(3F?W_F5E;J'Q_2``\"Y``\"C``!=``!\"```H```)``!G``\"Z#P_05%3>DY/E\r\nMK*SIF9GM967O)277``#!``\"Q``\"<``!M``!3```V```;```%``!*``\"!``#+\r\nM(\"#=9V?HG)SKIJ;MBHKO45'O%!31``##``\"V``!X``!>``! ```B``!7``\"2\r\nM``#\"``#:&QOH557L>'CO>'CO5U?O)B;A``#.``\"W``\"G``\"5``!'```K```/\r\nM``\"=``#%``#A!07K*\"CO/#SO-37O&QOC``#0``#)``\"U``\"7``\"$``!L``!/\r\nM```2```\"``!B``#I``#O`@+G``#8``#+``\"Z``\"P``!P```3```D``!8``#(\r\nM``#3``#-``\"S``\"#``!N```>``!^``# ``\"D``\"-``!_``!I``!0```P``\"1\r\nM``\"I``\"\\``\"J``\";``!E``!)```J```.```T``\"L``\"O``\"M``\"F``\")``!Z\r\nM``!K``!:```^```I``!J``\"\"``\"?``\">``\"6``\"/``!\\```9```'``!5``\".\r\nM``\"*```X```0```_``!R``\" ``!<```W```L``!F``!#``!6```@```S```\\\r\nM```Z```?```,```=```-````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#\\\r\nM+ME%`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```((241!5'B<8V\" @_\\0P( !F)A96%G9V#DX,:4YN+AY>'GY^+D%\r\nM!#E0)?\\S\"_$(BXB*B4M(\\DH)2?D%A47%R26E9E$=Y1258[C^3D&15=4UM77U#8U.SJWW[10_(IZTQ.W@($E7_+;BD#F\\3WZ*P;-F1H[.WSI'D/29P'!J+__\\?\r\nMESUQV..DR*)3B[:J;SNM?49(V@(N%\\%VEK_#Y=PV^?9=PIE\\85.E(^\")X_]_\r\nMCH.R8>=Y0S,OA&JGFV5T6B\"EF___#TE?7'M)ZO+E*]P[KQ[O0DY20);%M2FL\r\nMUR]>O7B=[09:<@.QF2QDM-S=M2PP4^)_5(\":\"/%(84W7`)A(.MC?YL?R````\r\nM)71%6'1#;VUM96YT`&-L:7 R9VEF('8N,\"XV(&)Y(%EV97,@4&EG=65T-G,[\r\n-O ````!)14Y$KD)@@@``\r\n`\r\nend\r\n", - "is_html": false + "body": "\r\nThe Hare and the Tortoise\r\n\r\nA HARE one day ridiculed the short feet and slow pace of the Tortoise, who\r\nreplied, laughing: \"Though you be swift as the wind, I will beat you in a\r\nrace.\" The Hare, believing her assertion to be simply impossible, assented\r\nto the proposal; and they agreed that the Fox should choose the course and\r\nfix the goal. On the day appointed for the race the two started together.\r\nThe Tortoise never for a moment stopped, but went on with a slow but steady\r\npace straight to the end of the course. The Hare, lying down by the\r\nwayside, fell fast asleep. At last waking up, and moving as fast as he\r\ncould, he saw the Tortoise had reached the goal, and was comfortably dozing\r\nafter her fatigue.\r\n\r\nSlow but steady wins the race.\r\n\r\n\r\nbegin 666 blueball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM``@``! ``!@`````\"\"D`$$(`$$H`\"#$`$%(((7,(*7L(*80((6L`&%H`\"#D(\r\nM(6,0.9P80J480JT80K40.:40,90`&%(0,8PI4K4Y8\\8Y8\\XI6LX82LX80LX8\r\nM0KU\":\\9[G-:\\ZMSMZESN]:C.\\0,9Q:A-:MUN?.[^^,O>]*>^\\8.:482L:,\r\nMO>>UY^^4O>\\``\"E:C.=SI>]KG.\\(*8PQ8^\\I6N\\((7L`````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#!\r\nM,@U5`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```&(241!5'B<==)M5YLP& ;@$DZ )A!2DX;,\"4RG!2+:JHO;K&_;\r\nM?/G_ORA[TE;LL<>;+YQSG3LAY!F-A@0H1\"APHYT$.(HA48+#CXS'A*80DK$H\r\nM0=OHT(*,54I*9+0#>J23(LO^U\\/RJJ64PV(!L1,[WT[//I^?#)K6MGI\r\nM+#)O>P8QG>P?GO:G9^?SIFP7BC\"\\*;J$:W%QV??]U8]Y4]7\"4I:#>0PB,I'7\r\nM/_O^U^^;65/60H&%:PMCNKR]OKN_?_\"U5B[>S3T66I0'?_[^N_&[U:+3A*_,\r\nMC1QF3Z*=S9]?&D]R:M,L3@9+EW75@%1 \"ZLIC_UW>GLLJ)5M65:W-=!2:<+\\\r\nM^59F8J*F==U\"28H.B,.2&PMSEJJE%%(N.JOT:U9$9K4D6(\"++%6VZZRU*O6$\r\nMUS5_B# 'U$HIG5+\"BR@9\"(HF'W-\"*7TEG(^!UBNNS\"&3QP7CG#.X=[-I;7XV\r\nM8))'D!PF`FV3QP`9@XT)W^7M;OUK@. 9P&T-Q6ZVI^E3^8B[X[L#_P$45,S8\r\nMF6D.OP```\"5T15AT0V]M;65N= !C;&EP,F=I9B!V+C N-B!B>2!9=F5S(%!I\r\n49W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 greenball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM````$ ``& ``(0``\" ``,0``0@``4@``6@``2@`(8P`(P`0C `(:P``\r\nM.0``8P`0E `0G `AI0`0I0`AK0!\"O1ACQC%CQCE2QB$IS@`8O0`0K0`8K0`A\r\nMO0\"4UF.MUGN$UE)*WA@AU@`8Q@`8M0``*0!\"SA#.YY3>YZW&YY24YV-2YR$A\r\nMW@`8S@!2WB&KRU;5>]/60`]SX,0^'\\8HC[&`29]Y('?:!&F+.2<\r\nMAR(@R.NVVF@02C4<#N-8#:LMN[^]G#XU-FDB)VC_PW8#K614(E9K+_6\\Z7)DR)5\r\nM&]$:$C(QV7R9F9)&BH>4:+^V`8\\38\\HF1ZGD+*AN[TSC4*5)7LIWJN2V#52)\r\nM6-AWSS)*\"R>Q(T9Q!/W:?$T$ERJ.E9)RP\\KW!$V2%B)\"RQ XWX2\"D@ZY1A=>\r\nM0!EC0M\"@W]+6K ]T1##&U$6K84.VWA,`-4*11EZU$YV]<1^^#V&Y+*TTV=K_\r\nMJK>-T@@L+ ```\"5T15AT0V]M;65N= !C;&EP,F=I\r\nF9B!V+C N-B!B>2!9=F5S(%!I9W5E=#9S.[P`````245.1*Y\"8((`\r\n`\r\nend\r\n\r\nbegin 666 redball.png\r\nMB5!.1PT*&@H````-24A$4@```!L````;\" ,```\"Z\"@1G```#`%!,5$7___\\`\r\nM```!```+```5```:```7```1```*```#```<```R``!$``!-``!(```]```C\r\nM```6```F``!A``![``\"&``\"'``!]``!T``!@```Y```4```&```G``!+``!O\r\nM``\"0``\"E``\"[``\"_``\"K``\"A``\",``!S``!;```N```(``!,``!W``\"9``\"T\r\nM&1G*.#C5/3W;*2G=!06X``\"H``!Y```Q```8```$``!%``\":``\"[)\"3186'?\r\nMA(3F?W_F5E;J'Q_2``\"Y``\"C``!=``!\"```H```)``!G``\"Z#P_05%3>DY/E\r\nMK*SIF9GM967O)277``#!``\"Q``\"<``!M``!3```V```;```%``!*``\"!``#+\r\nM(\"#=9V?HG)SKIJ;MBHKO45'O%!31``##``\"V``!X``!>``! ```B``!7``\"2\r\nM``#\"``#:&QOH557L>'CO>'CO5U?O)B;A``#.``\"W``\"G``\"5``!'```K```/\r\nM``\"=``#%``#A!07K*\"CO/#SO-37O&QOC``#0``#)``\"U``\"7``\"$``!L``!/\r\nM```2```\"``!B``#I``#O`@+G``#8``#+``\"Z``\"P``!P```3```D``!8``#(\r\nM``#3``#-``\"S``\"#``!N```>``!^``# ``\"D``\"-``!_``!I``!0```P``\"1\r\nM``\"I``\"\\``\"J``\";``!E``!)```J```.```T``\"L``\"O``\"M``\"F``\")``!Z\r\nM``!K``!:```^```I``!J``\"\"``\"?``\">``\"6``\"/``!\\```9```'``!5``\".\r\nM``\"*```X```0```_``!R``\" ``!<```W```L``!F``!#``!6```@```S```\\\r\nM```Z```?```,```=```-````````````````````````````````````````\r\nM````````````````````````````````````````````````````````````\r\nM``````````````````````````````````````````````````````````#\\\r\nM+ME%`````7123E,`0.;89@```!9T15AT4V]F='=AOF@```((241!5'B<8V\" @_\\0P( !F)A96%G9V#DX,:4YN+AY>'GY^+D%\r\nM!#E0)?\\S\"_$(BXB*B4M(\\DH)2?D%A47%R26E9E$=Y1258[C^3D&15=4UM77U#8U.SJWW[10_(IZTQ.W@($E7_+;BD#F\\3WZ*P;-F1H[.WSI'D/29P'!J+__\\?\r\nMESUQV..DR*)3B[:J;SNM?49(V@(N%\\%VEK_#Y=PV^?9=PIE\\85.E(^\")X_]_\r\nMCH.R8>=Y0S,OA&JGFV5T6B\"EF___#TE?7'M)ZO+E*]P[KQ[O0DY20);%M2FL\r\nMUR]>O7B=[09:<@.QF2QDM-S=M2PP4^)_5(\":\"/%(84W7`)A(.MC?YL?R````\r\nM)71%6'1#;VUM96YT`&-L:7 R9VEF('8N,\"XV(&)Y(%EV97,@4&EG=65T-G,[\r\n-O ````!)14Y$KD)@@@``\r\n`\r\nend\r\n" } } ], diff --git a/tests/legacy/050.txt b/tests/legacy/050.txt index d303841..ac1db38 100644 --- a/tests/legacy/050.txt +++ b/tests/legacy/050.txt @@ -121,11 +121,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } + "message_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche" }, "date": { "DateTime": { @@ -140,31 +140,31 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" } }, "headers_other": { + "X-Priority": { + "Text": "2 (High)" + }, "X-Sender": { "Text": "dwsauder@pop.example.com (Unverified)" }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Priority": { - "Text": "2 (High)" } }, "headers_offsets": [ @@ -246,16 +246,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 1, + 2 ], "parts": [ { - "Text": { + "Html": { "headers": { "content_transfer_encoding": { "Text": "quoted-printable" @@ -270,15 +266,14 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "contents": "\n\"2aa658b6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\"2aa658c0.png\"
\n", - "is_html": true + "body": "\n\"2aa658b6.png\"
\n
\nDie Hasen und die\nFrösche
\n
\n
Die Hasen klagten einst über\nihre mißliche Lage; "wir leben", sprach ein Redner, "in\nsteter Furcht vor Menschen und Tieren, eine Beute der Hunde, der Adler,\nja fast aller Raubtiere! Unsere stete Angst ist ärger als der Tod selbst.\nAuf, laßt uns ein für allemal sterben."
\n
\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu;\nallein das außerordentliche Getöse und ihre wunderbare Gestalt\nerschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs\nschnellste untertauchten.
\n
\n"Halt", rief nun eben dieser Sprecher, "wir wollen das\nErsäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr\nseht, einige Tiere, welche also wohl noch unglücklicher sein müssen als\nwir."
\n
\n\"2aa658c0.png\"
\n" } }, { "Binary": { "headers": { - "content_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2" + "content_transfer_encoding": { + "Text": "base64" }, "content_type": { "ContentType": { @@ -289,6 +284,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -296,12 +294,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "2aa658b6.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1633,17 +1628,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "filename": "2aa658c0.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -1655,9 +1639,20 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== }, "content_id": { "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "filename": "2aa658c0.png" + } + } + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/051.txt b/tests/legacy/051.txt index 204eeb2..f288a7b 100644 --- a/tests/legacy/051.txt +++ b/tests/legacy/051.txt @@ -163,21 +163,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, "subject": { "Text": "Die Hasen und die Frösche" }, "message_id": { "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com" }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -187,6 +181,18 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -199,23 +205,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } } }, "headers_other": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" + "X-Priority": { + "Text": "2 (High)" }, "X-Mailer": { "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" }, - "X-Priority": { - "Text": "2 (High)" + "X-Sender": { + "Text": "dwsauder@pop.example.com (Unverified)" } }, "headers_offsets": [ @@ -297,18 +297,10 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= 1 ], "attachments": [ - { - "Attachment": 2 - }, - { - "Attachment": 3 - }, - { - "Attachment": 4 - }, - { - "Attachment": 5 - } + 2, + 3, + 4, + 5 ], "parts": [ { @@ -328,9 +320,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -339,18 +328,17 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n2aa5e03a.png2aa5e044.png", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n\n2aa5e03a.png2aa5e044.png" } }, { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -359,6 +347,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -372,7 +363,7 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -1704,6 +1695,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -1713,8 +1707,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_id": { + "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.3" }, "content_disposition": { "ContentType": { @@ -1723,12 +1717,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "2aa5e044.png" } } - }, - "content_id": { - "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.3" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -3188,9 +3179,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -3207,9 +3195,12 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, @@ -4549,6 +4540,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -4557,12 +4551,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": [ + "body": [ 137, 80, 78, diff --git a/tests/legacy/052.txt b/tests/legacy/052.txt index 1e47530..518c6ae 100644 --- a/tests/legacy/052.txt +++ b/tests/legacy/052.txt @@ -48,34 +48,34 @@ welche also wohl noch ungl "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "subject": { "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" }, "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } } }, "headers_other": { - "Importance": { - "Text": "Normal" - }, "X-MSMail-Priority": { "Text": "Normal" }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + }, "X-Priority": { "Text": "3 (Normal)" }, "X-Mailer": { "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" + "Importance": { + "Text": "Normal" } }, "headers_offsets": [ @@ -159,8 +159,7 @@ welche also wohl noch ungl "parts": [ { "Text": { - "contents": "Die Hasen und die Fr�sche\r\n\r\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der Tod\r\nselbst. Auf, la�t uns ein f�r allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\r\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt erschreckte\r\neine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\r\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\r\n\r\n", - "is_html": false + "body": "Die Hasen und die Fr�sche\r\n\r\nDie Hasen klagten einst �ber ihre mi�liche Lage; \"wir leben\", sprach ein\r\nRedner, \"in steter Furcht vor Menschen und Tieren, eine Beute der Hunde, der\r\nAdler, ja fast aller Raubtiere! Unsere stete Angst ist �rger als der Tod\r\nselbst. Auf, la�t uns ein f�r allemal sterben.\"\r\n\r\nIn einem nahen Teich wollten sie sich nun ers�ufen; sie eilten ihm zu;\r\nallein das au�erordentliche Get�se und ihre wunderbare Gestalt erschreckte\r\neine Menge Fr�sche, die am Ufer sa�en, so sehr, da� sie aufs schnellste\r\nuntertauchten.\r\n\r\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ers�ufen noch ein\r\nwenig aufschieben, denn auch uns f�rchten, wie ihr seht, einige Tiere,\r\nwelche also wohl noch ungl�cklicher sein m�ssen als wir.\"\r\n\r\n" } } ], diff --git a/tests/legacy/053.txt b/tests/legacy/053.txt index faf7da7..eb8c348 100644 --- a/tests/legacy/053.txt +++ b/tests/legacy/053.txt @@ -34,24 +34,21 @@ als wir."=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@example.com" } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com" - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -79,23 +76,26 @@ als wir."=20 "tz_hour": 4, "tz_minute": 0 } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, "headers_other": { - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" + "Importance": { + "Text": "Normal" }, "X-Priority": { "Text": "3 (Normal)" }, - "Importance": { - "Text": "Normal" + "X-Mailer": { + "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" }, "X-MSMail-Priority": { "Text": "Normal" + }, + "X-MimeOLE": { + "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" } }, "headers_offsets": [ @@ -200,8 +200,7 @@ als wir."=20 "parts": [ { "Text": { - "contents": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n", - "is_html": false + "body": "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 selbst. Auf, laßt uns ein für allemal sterben.\" \n\nIn einem nahen Teich wollten sie sich nun ersäufen; sie eilten ihm zu; allein das außerordentliche Getöse und ihre wunderbare Gestalt erschreckte eine Menge Frösche, die am Ufer saßen, so sehr, daß sie aufs schnellste untertauchten. \n\n\"Halt\", rief nun eben dieser Sprecher, \"wir wollen das Ersäufen noch ein wenig aufschieben, denn auch uns fürchten, wie ihr seht, einige Tiere, welche also wohl noch unglücklicher sein müssen als wir.\" \n" } } ], diff --git a/tests/malformed/000.txt b/tests/malformed/000.txt index 2e124fe..2cc76a0 100644 --- a/tests/malformed/000.txt +++ b/tests/malformed/000.txt @@ -42,8 +42,7 @@ Content-Type: text/html "parts": [ { "Text": { - "contents": "Content-Type: text/plain", - "is_html": false + "body": "Content-Type: text/plain" } }, { @@ -56,8 +55,7 @@ Content-Type: text/html } } }, - "contents": "Content-Type: text/html", - "is_html": false + "body": "Content-Type: text/html" } } ], diff --git a/tests/malformed/001.txt b/tests/malformed/001.txt index 3e3b545..ace1eb6 100644 --- a/tests/malformed/001.txt +++ b/tests/malformed/001.txt @@ -53,8 +53,7 @@ Content-Type: text/plain }, { "Text": { - "contents": "Content-Type: text/plain\n", - "is_html": false + "body": "Content-Type: text/plain\n" } } ], diff --git a/tests/malformed/002.txt b/tests/malformed/002.txt index 1f0072b..ab8792f 100644 --- a/tests/malformed/002.txt +++ b/tests/malformed/002.txt @@ -25,15 +25,12 @@ body } ], "attachments": [ - { - "Attachment": 0 - } + 0 ], "parts": [ { "Text": { - "contents": "body\n", - "is_html": false + "body": "body\n" } } ], diff --git a/tests/malformed/003.txt b/tests/malformed/003.txt index d5e01fa..3762665 100644 --- a/tests/malformed/003.txt +++ b/tests/malformed/003.txt @@ -31,9 +31,7 @@ body } ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { @@ -59,8 +57,7 @@ body } } }, - "contents": "body\n", - "is_html": false + "body": "body\n" } } ], diff --git a/tests/malformed/004.txt b/tests/malformed/004.txt index f8859da..072de8f 100644 --- a/tests/malformed/004.txt +++ b/tests/malformed/004.txt @@ -31,15 +31,12 @@ body } ], "attachments": [ - { - "Attachment": 0 - } + 0 ], "parts": [ { "Text": { - "contents": "Content-Type: multipart/mixed; boundary=\"a\"\n\n--ac\nContent-Type: text/plain\n\nbody\n", - "is_html": false + "body": "Content-Type: multipart/mixed; boundary=\"a\"\n\n--ac\nContent-Type: text/plain\n\nbody\n" } } ], diff --git a/tests/malformed/005.txt b/tests/malformed/005.txt index 805851d..4a63a20 100644 --- a/tests/malformed/005.txt +++ b/tests/malformed/005.txt @@ -64,8 +64,7 @@ body2 } } }, - "contents": "body", - "is_html": false + "body": "body" } } ], diff --git a/tests/malformed/006.txt b/tests/malformed/006.txt index dc260ae..100605c 100644 --- a/tests/malformed/006.txt +++ b/tests/malformed/006.txt @@ -31,9 +31,7 @@ body } ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { @@ -59,8 +57,7 @@ body } } }, - "contents": "body\n", - "is_html": false + "body": "body\n" } } ], diff --git a/tests/malformed/007.txt b/tests/malformed/007.txt index dfb124e..723462b 100644 --- a/tests/malformed/007.txt +++ b/tests/malformed/007.txt @@ -33,16 +33,11 @@ Content-Type: text/plain } ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { "Multipart": { - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -51,13 +46,15 @@ Content-Type: text/plain "boundary": "ab" } } + }, + "mime_version": { + "Text": "1.0" } } }, { "Text": { - "contents": "--a--\n\n", - "is_html": false + "body": "--a--\n\n" } } ], diff --git a/tests/malformed/008.txt b/tests/malformed/008.txt index dca2e5c..2f6f8e1 100644 --- a/tests/malformed/008.txt +++ b/tests/malformed/008.txt @@ -35,9 +35,7 @@ body2 } ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { @@ -63,8 +61,7 @@ body2 } } }, - "contents": "body\n--ab\nContent-Type: text/html\n\nbody2\n", - "is_html": false + "body": "body\n--ab\nContent-Type: text/html\n\nbody2\n" } } ], diff --git a/tests/malformed/009.txt b/tests/malformed/009.txt index c8b294b..c9cba54 100644 --- a/tests/malformed/009.txt +++ b/tests/malformed/009.txt @@ -45,9 +45,7 @@ Content-Type: text/plain 1 ], "attachments": [ - { - "Attachment": 2 - } + 2 ], "parts": [ { @@ -73,8 +71,7 @@ Content-Type: text/plain } } }, - "contents": "1", - "is_html": false + "body": "1" } }, { @@ -87,8 +84,7 @@ Content-Type: text/plain } } }, - "contents": "22\n--1\nContent-Type: text/plain\n\n333\n", - "is_html": false + "body": "22\n--1\nContent-Type: text/plain\n\n333\n" } } ], diff --git a/tests/malformed/010.txt b/tests/malformed/010.txt index 85748fb..2a84e13 100644 --- a/tests/malformed/010.txt +++ b/tests/malformed/010.txt @@ -26,24 +26,12 @@ Content-Type: text/plain } ], "attachments": [ - { - "Attachment": 1 - } + 0 ], "parts": [ - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } - } - }, { "Message": { - "headers_rfc": { + "headers": { "content_type": { "ContentType": { "c_type": "message", @@ -51,84 +39,91 @@ Content-Type: text/plain } } }, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 43, - "end": 59 - } - ], - "attachments": [ - { - "Attachment": 1 - } - ], - "parts": [ - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + "body": { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - } + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" }, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 73, - "end": 85 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "1\n", - "is_html": false - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 60, - "offset_body": 86, - "offset_end": 88 + "start": 43, + "end": 59 } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 30, - "offset_body": 60, - "offset_end": 88 + ], + "attachments": [ + 0 + ], + "parts": [ + { + "Message": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" + } + } + }, + "body": { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" + } + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 73, + "end": 85 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "1\n" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 60, + "offset_body": 86, + "offset_end": 88 + } + } + } + ], + "structure": { + "List": [] + }, + "offset_header": 30, + "offset_body": 60, + "offset_end": 88 + } } } ], "structure": { - "Part": 0 + "List": [] }, "offset_header": 0, "offset_body": 30, diff --git a/tests/malformed/011.txt b/tests/malformed/011.txt index c8b294b..c9cba54 100644 --- a/tests/malformed/011.txt +++ b/tests/malformed/011.txt @@ -45,9 +45,7 @@ Content-Type: text/plain 1 ], "attachments": [ - { - "Attachment": 2 - } + 2 ], "parts": [ { @@ -73,8 +71,7 @@ Content-Type: text/plain } } }, - "contents": "1", - "is_html": false + "body": "1" } }, { @@ -87,8 +84,7 @@ Content-Type: text/plain } } }, - "contents": "22\n--1\nContent-Type: text/plain\n\n333\n", - "is_html": false + "body": "22\n--1\nContent-Type: text/plain\n\n333\n" } } ], diff --git a/tests/malformed/012.txt b/tests/malformed/012.txt index a9c4b2b..081c79a 100644 --- a/tests/malformed/012.txt +++ b/tests/malformed/012.txt @@ -45,12 +45,8 @@ Content-Type: text/plain } ], "attachments": [ - { - "Attachment": 2 - }, - { - "Attachment": 4 - } + 1, + 2 ], "parts": [ { @@ -67,118 +63,107 @@ Content-Type: text/plain } }, { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" + "Message": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" + } } + }, + "body": { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" + } + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 141, + "end": 153 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "1" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 128, + "offset_body": 154, + "offset_end": 160 } } }, { "Message": { - "headers_rfc": { + "headers": { "content_type": { "ContentType": { - "c_type": "text", - "c_subtype": "plain" + "c_type": "message", + "c_subtype": "rfc822" } } }, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 141, - "end": 153 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "1", - "is_html": false + "body": { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" + } } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 128, - "offset_body": 154, - "offset_end": 160 - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "content_type" + }, + "start": 203, + "end": 215 + } + ], + "attachments": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "22\n--1\nContent-Type: message/rfc822\n\nContent-Type: text/plain\n\n333\n" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 190, + "offset_body": 216, + "offset_end": 283 } } - }, - { - "Message": { - "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 203, - "end": 215 - } - ], - "attachments": [ - { - "Attachment": 0 - } - ], - "parts": [ - { - "Text": { - "contents": "22\n--1\nContent-Type: message/rfc822\n\nContent-Type: text/plain\n\n333\n", - "is_html": false - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 190, - "offset_body": 216, - "offset_end": 283 - } } ], "structure": { "MultiPart": [ 0, - [ - { - "Part": 1 - }, - { - "Part": 3 - } - ] + [] ] }, "offset_header": 0, diff --git a/tests/malformed/013.txt b/tests/malformed/013.txt index 2a5e515..d05a4e8 100644 --- a/tests/malformed/013.txt +++ b/tests/malformed/013.txt @@ -86,12 +86,14 @@ hello, world } } }, - "contents": "hello, world", - "is_html": false + "body": "hello, world" } }, { "Multipart": { + "mime_version": { + "Text": "2.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -100,9 +102,6 @@ hello, world "boundary": "1" } } - }, - "mime_version": { - "Text": "2.0" } } }, @@ -116,8 +115,7 @@ hello, world } } }, - "contents": "hello, world", - "is_html": false + "body": "hello, world" } }, { @@ -146,8 +144,7 @@ hello, world } } }, - "contents": "hello, world", - "is_html": false + "body": "hello, world" } }, { @@ -173,8 +170,7 @@ hello, world } } }, - "contents": "hello, world", - "is_html": false + "body": "hello, world" } } ], diff --git a/tests/malformed/014.txt b/tests/malformed/014.txt index ab2de1a..53237f1 100644 --- a/tests/malformed/014.txt +++ b/tests/malformed/014.txt @@ -45,8 +45,7 @@ hello, world } } }, - "contents": "hello, world", - "is_html": false + "body": "hello, world" } } ], diff --git a/tests/malformed/015.txt b/tests/malformed/015.txt index 1591aee..4ffd0c7 100644 --- a/tests/malformed/015.txt +++ b/tests/malformed/015.txt @@ -27,41 +27,41 @@ invalid ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Test User", - "address": "test@example.org" - } - }, "message_id": { "Text": "1.2.3.4@example" }, - "mime_version": { - "Text": "1.0" - }, - "return_path": { - "Text": "test@example.org" + "subject": { + "Text": "Hello world" }, "content_type": { "ContentType": { "c_type": "multipart", "c_subtype": "signed", "attributes": { - "protocol": "application/pgp-signature", + "boundary": "=-GNQXLhuj24Pl1aCkk4/d", "micalg": "pgp-sha1", - "boundary": "=-GNQXLhuj24Pl1aCkk4/d" + "protocol": "application/pgp-signature" } } }, - "subject": { - "Text": "Hello world" - }, "to": { "Address": { "name": "Another User", "address": "test2@example.org" } }, + "return_path": { + "Text": "test@example.org" + }, + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Test User", + "address": "test@example.org" + } + }, "date": { "DateTime": { "year": 2007, @@ -141,26 +141,23 @@ invalid 0 ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain" } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "There was a day \na happy day\n", - "is_html": false + "body": "There was a day \na happy day\n" } }, { @@ -176,7 +173,7 @@ invalid } } }, - "contents": [ + "body": [ 105, 110, 118, diff --git a/tests/malformed/016.txt b/tests/malformed/016.txt index 23f2bf3..8a4b7be 100644 --- a/tests/malformed/016.txt +++ b/tests/malformed/016.txt @@ -52,9 +52,7 @@ Content-Type: text/plain 2 ], "attachments": [ - { - "Attachment": 3 - } + 3 ], "parts": [ { @@ -93,8 +91,7 @@ Content-Type: text/plain } } }, - "contents": "1\n--1234567890123456789012345678901234567890123456789012345678901234567890123456789012\nContent-Type: text/plain\n\n22\n--123456789012345678901234567890123456789012345678901234567890123456789012345678901\nContent-Type: text/plain\n\n333", - "is_html": false + "body": "1\n--1234567890123456789012345678901234567890123456789012345678901234567890123456789012\nContent-Type: text/plain\n\n22\n--123456789012345678901234567890123456789012345678901234567890123456789012345678901\nContent-Type: text/plain\n\n333" } }, { @@ -107,8 +104,7 @@ Content-Type: text/plain } } }, - "contents": "4444\n", - "is_html": false + "body": "4444\n" } } ], diff --git a/tests/rfc/000.txt b/tests/rfc/000.txt index 9b0e1d4..23ec9a5 100644 --- a/tests/rfc/000.txt +++ b/tests/rfc/000.txt @@ -74,14 +74,8 @@ Content-Transfer-Encoding: Quoted-printable ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } + "subject": { + "Text": "A multipart example" }, "content_type": { "ContentType": { @@ -92,12 +86,15 @@ Content-Transfer-Encoding: Quoted-printable } } }, - "from": { + "to": { "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@nsb.fv.com" + "name": "Ned Freed", + "address": "ned@innosoft.com" } }, + "mime_version": { + "Text": "1.0" + }, "date": { "DateTime": { "year": 1994, @@ -111,8 +108,11 @@ Content-Transfer-Encoding: Quoted-printable "tz_minute": 0 } }, - "subject": { - "Text": "A multipart example" + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@nsb.fv.com" + } } }, "headers_offsets": [ @@ -168,24 +168,15 @@ Content-Transfer-Encoding: Quoted-printable 1 ], "attachments": [ - { - "Attachment": 3 - }, - { - "Attachment": 4 - }, - { - "Attachment": 5 - }, - { - "Attachment": 7 - } + 3, + 4, + 5, + 6 ], "parts": [ { "Text": { - "contents": "... Some text appears here ...\n\n[Note that the blank between the boundary and the start\nof the text in this part means no header fields were\ngiven and this is text in the US-ASCII character set.\nIt could have been done with explicit typing as in the\nnext part.]\n", - "is_html": false + "body": "... Some text appears here ...\n\n[Note that the blank between the boundary and the start\nof the text in this part means no header fields were\ngiven and this is text in the US-ASCII character set.\nIt could have been done with explicit typing as in the\nnext part.]\n" } }, { @@ -201,8 +192,7 @@ Content-Transfer-Encoding: Quoted-printable } } }, - "contents": "This could have been part of the previous part, but\nillustrates explicit versus implicit typing of body\nparts.\n", - "is_html": false + "body": "This could have been part of the previous part, but\nillustrates explicit versus implicit typing of body\nparts.\n" } }, { @@ -231,8 +221,7 @@ Content-Transfer-Encoding: Quoted-printable "Text": "base64" } }, - "contents": "... base64-encoded 8000 Hz single-channel\n mu-law-format audio data goes here ...\n", - "is_html": false + "body": "... base64-encoded 8000 Hz single-channel\n mu-law-format audio data goes here ...\n" } }, { @@ -248,8 +237,7 @@ Content-Transfer-Encoding: Quoted-printable } } }, - "contents": "... base64-encoded image data goes here ...\n", - "is_html": false + "body": "... base64-encoded image data goes here ...\n" } }, { @@ -262,106 +250,104 @@ Content-Transfer-Encoding: Quoted-printable } } }, - "contents": "This is enriched.\nas defined in RFC 1896\n\nIsn't it\ncool?\n", - "is_html": false - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } + "body": "This is enriched.\nas defined in RFC 1896\n\nIsn't it\ncool?\n" } }, { "Message": { - "headers_rfc": { - "from": { - "Address": { - "name": "mailbox in US-ASCII" - } - }, - "to": { - "Address": { - "name": "address in US-ASCII" - } - }, - "subject": { - "Text": "(subject in US-ASCII)" - }, + "headers": { "content_type": { "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "ISO-8859-1" + "c_type": "message", + "c_subtype": "rfc822" + } + } + }, + "body": { + "headers_rfc": { + "from": { + "Address": { + "name": "mailbox in US-ASCII" + } + }, + "to": { + "Address": { + "name": "address in US-ASCII" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "ISO-8859-1" + } + } + }, + "content_transfer_encoding": { + "Text": "Quoted-printable" + }, + "subject": { + "Text": "(subject in US-ASCII)" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 1612, + "end": 1635 + }, + { + "name": { + "Rfc": "to" + }, + "start": 1638, + "end": 1661 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 1669, + "end": 1692 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 1705, + "end": 1737 + }, + { + "name": { + "Rfc": "content_transfer_encoding" + }, + "start": 1763, + "end": 1781 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "... Additional text in ISO-8859-1 goes here ...\n" } } + ], + "structure": { + "Part": 0 }, - "content_transfer_encoding": { - "Text": "Quoted-printable" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 1612, - "end": 1635 - }, - { - "name": { - "Rfc": "to" - }, - "start": 1638, - "end": 1661 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 1669, - "end": 1692 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 1705, - "end": 1737 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 1763, - "end": 1781 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "... Additional text in ISO-8859-1 goes here ...\n", - "is_html": false - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 1607, - "offset_body": 1782, - "offset_end": 1850 + "offset_header": 1607, + "offset_body": 1782, + "offset_end": 1850 + } } } ], @@ -388,9 +374,6 @@ Content-Transfer-Encoding: Quoted-printable }, { "Part": 5 - }, - { - "Part": 6 } ] }, diff --git a/tests/rfc/001.txt b/tests/rfc/001.txt index ad24a99..e1d9e23 100644 --- a/tests/rfc/001.txt +++ b/tests/rfc/001.txt @@ -42,28 +42,12 @@ get RFC-MIME.DOC ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Whomever" - } - }, - "to": { - "Address": { - "name": "Someone" - } + "mime_version": { + "Text": "1.0" }, "message_id": { "Text": "id1@host.com" }, - "content_id": { - "Text": "id001@guppylake.bellcore.com" - }, - "subject": { - "Text": "whatever" - }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -72,6 +56,22 @@ get RFC-MIME.DOC "boundary": "42" } } + }, + "content_id": { + "Text": "id001@guppylake.bellcore.com" + }, + "to": { + "Address": { + "name": "Someone" + } + }, + "subject": { + "Text": "whatever" + }, + "from": { + "Address": { + "name": "Whomever" + } } }, "headers_offsets": [ @@ -133,15 +133,9 @@ get RFC-MIME.DOC } ], "attachments": [ - { - "Attachment": 0 - }, - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 0, + 1, + 2 ], "parts": [ { @@ -152,17 +146,17 @@ get RFC-MIME.DOC "c_type": "message", "c_subtype": "external-body", "attributes": { - "access-type": "ANON-FTP", - "name": "BodyFormats.ps", - "directory": "pub", "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "directory": "pub", + "mode": "image", + "name": "BodyFormats.ps", "site": "thumper.bellcore.com", - "mode": "image" + "access-type": "ANON-FTP" } } } }, - "contents": [ + "body": [ 67, 111, 110, @@ -253,15 +247,15 @@ get RFC-MIME.DOC "c_type": "message", "c_subtype": "external-body", "attributes": { - "name": "/u/nsb/writing/rfcs/RFC-MIME.ps", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "access-type": "local-file", "site": "thumper.bellcore.com", - "access-type": "local-file" + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "name": "/u/nsb/writing/rfcs/RFC-MIME.ps" } } } }, - "contents": [ + "body": [ 67, 111, 110, @@ -353,13 +347,13 @@ get RFC-MIME.DOC "c_subtype": "external-body", "attributes": { "server": "listserv@bogus.bitnet", - "access-type": "mail-server", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "access-type": "mail-server" } } } }, - "contents": [ + "body": [ 67, 111, 110, diff --git a/tests/rfc/002.txt b/tests/rfc/002.txt index 70d80cb..cfc3194 100644 --- a/tests/rfc/002.txt +++ b/tests/rfc/002.txt @@ -74,12 +74,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "White House Transportation Coordinator", - "address": "transport@whitehouse.gov" - } - }, "subject": { "Text": "[Fwd: Map of Argentina with Description]" }, @@ -97,6 +91,12 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "boundary": "D7F------------D7FD5A0B8AB9C65CCDBFA872" } } + }, + "to": { + "Address": { + "name": "White House Transportation Coordinator", + "address": "transport@whitehouse.gov" + } } }, "headers_offsets": [ @@ -136,9 +136,7 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz 0 ], "attachments": [ - { - "Attachment": 2 - } + 1 ], "parts": [ { @@ -157,536 +155,525 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "Text": "7bit" } }, - "contents": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl", - "is_html": false - } - }, - { - "Multipart": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } - }, - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } + "body": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl" } }, { "Message": { - "headers_rfc": { - "from": { - "Address": { - "name": "Bill Clinton", - "address": "president@whitehouse.gov" + "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline" } }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Map of Argentina with Description" - }, "content_type": { "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "DC8------------DC8638F443D87A7F0726DEF7" + "c_type": "message", + "c_subtype": "rfc822" + } + } + }, + "body": { + "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "DC8------------DC8638F443D87A7F0726DEF7" + } + } + }, + "message_id": { + "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" + }, + "subject": { + "Text": "Map of Argentina with Description" + }, + "from": { + "Address": { + "name": "Bill Clinton", + "address": "president@whitehouse.gov" + } + }, + "return_path": { + "Text": "president@whitehouse.gov" + }, + "received": { + "Collection": [ + { + "Text": "from mailhost.whitehouse.gov ([192.168.51.200])\n by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453\n for ;\n Mon, 13 Aug 1998 l8:14:23 +1000" + }, + { + "Text": "from the_big_box.whitehouse.gov ([192.168.51.50])\n by mailhost.whitehouse.gov (8.8.8/8.8.7) with ESMTP id RAA20366\n for vice-president@whitehouse.gov; Mon, 13 Aug 1998 17:42:41 +1000" + } + ] + }, + "date": { + "DateTime": { + "year": 1998, + "month": 8, + "day": 13, + "hour": 17, + "minute": 42, + "second": 41, + "tz_before_gmt": false, + "tz_hour": 10, + "tz_minute": 0 + } + }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "A1 Gore (The Enforcer)", + "address": "vice-president@whitehouse.gov" } } }, - "date": { - "DateTime": { - "year": 1998, - "month": 8, - "day": 13, - "hour": 17, - "minute": 42, - "second": 41, - "tz_before_gmt": false, - "tz_hour": 10, - "tz_minute": 0 + "headers_offsets": [ + { + "name": { + "Rfc": "return_path" + }, + "start": 639, + "end": 667 + }, + { + "name": { + "Rfc": "received" + }, + "start": 676, + "end": 893 + }, + { + "name": { + "Rfc": "received" + }, + "start": 902, + "end": 1100 + }, + { + "name": { + "Rfc": "date" + }, + "start": 1105, + "end": 1138 + }, + { + "name": { + "Rfc": "message_id" + }, + "start": 1149, + "end": 1198 + }, + { + "name": { + "Rfc": "from" + }, + "start": 1203, + "end": 1244 + }, + { + "name": { + "Rfc": "to" + }, + "start": 1247, + "end": 1303 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 1311, + "end": 1347 + }, + { + "name": { + "Rfc": "mime_version" + }, + "start": 1360, + "end": 1365 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 1378, + "end": 1461 } - }, - "return_path": { - "Text": "president@whitehouse.gov" - }, - "to": { - "Address": { - "name": "A1 Gore (The Enforcer)", - "address": "vice-president@whitehouse.gov" + ], + "html_body": [ + 0, + 1 + ], + "text_body": [ + 0, + 1 + ], + "attachments": [ + 1 + ], + "parts": [ + { + "Text": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" + } + } + }, + "content_transfer_encoding": { + "Text": "7bit" + } + }, + "body": "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.1one1yp1anet.com/dest/sam/graphics/map-arg.htm\n\nThen again, shouldn't the CIA have something like that?\n\nBill" + } + }, + { + "InlineBinary": { + "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "attributes": { + "fi1ename": "map_of_Argentina.gif" + } + } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "gif", + "attributes": { + "name": "map_of_Argentina.gif" + } + } + }, + "content_transfer_encoding": { + "Text": "base64" + } + }, + "body": [ + 71, + 77, + 70, + 56, + 61, + 97, + 37, + 0, + 53, + 0, + 162, + 0, + 0, + 255, + 255, + 255, + 255, + 251, + 240, + 255, + 232, + 154, + 125, + 125, + 125, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 44, + 0, + 0, + 0, + 0, + 37, + 0, + 53, + 0, + 0, + 3, + 237, + 8, + 186, + 220, + 254, + 112, + 192, + 73, + 163, + 4, + 34, + 235, + 157, + 9, + 225, + 96, + 40, + 12, + 215, + 8, + 126, + 166, + 72, + 42, + 169, + 224, + 189, + 94, + 187, + 173, + 152, + 25, + 187, + 132, + 2, + 183, + 180, + 253, + 245, + 128, + 87, + 0, + 136, + 82, + 149, + 66, + 177, + 133, + 71, + 169, + 44, + 114, + 122, + 39, + 77, + 238, + 197, + 0, + 6, + 157, + 26, + 232, + 38, + 70, + 237, + 194, + 154, + 32, + 109, + 231, + 183, + 236, + 86, + 173, + 216, + 209, + 81, + 74, + 158, + 150, + 29, + 196, + 240, + 186, + 51, + 182, + 94, + 225, + 202, + 231, + 156, + 123, + 166, + 226, + 131, + 122, + 44, + 82, + 117, + 110, + 126, + 77, + 93, + 51, + 123, + 56, + 94, + 95, + 66, + 67, + 121, + 89, + 138, + 48, + 4, + 67, + 118, + 118, + 65, + 144, + 25, + 98, + 109, + 75, + 58, + 134, + 76, + 128, + 137, + 130, + 116, + 46, + 76, + 147, + 127, + 88, + 155, + 40, + 141, + 167, + 125, + 169, + 115, + 46, + 132, + 133, + 157, + 141, + 114, + 163, + 99, + 139, + 94, + 158, + 58, + 58, + 182, + 53, + 108, + 178, + 77, + 160, + 105, + 106, + 183, + 184, + 99, + 87, + 83, + 166, + 70, + 198, + 199, + 178, + 147, + 196, + 154, + 176, + 108, + 55, + 39, + 209, + 145, + 205, + 212, + 208, + 147, + 45, + 98, + 28, + 219, + 220, + 60, + 211, + 72, + 225, + 50, + 222, + 41, + 215, + 204, + 191, + 45, + 47, + 50, + 162, + 235, + 34, + 219, + 238, + 197, + 240, + 214, + 242, + 230, + 227, + 185, + 224, + 237, + 38, + 231, + 243, + 238, + 43, + 72, + 8, + 28, + 72, + 72, + 160, + 193, + 131, + 8, + 19, + 42, + 60, + 152, + 0, + 0, + 59 + ] + } } - }, - "received": { - "Collection": [ + ], + "structure": { + "List": [ { - "Text": "from mailhost.whitehouse.gov ([192.168.51.200])\n by heartbeat.whitehouse.gov (8.8.8/8.8.8) with ESMTP id SAA22453\n for ;\n Mon, 13 Aug 1998 l8:14:23 +1000" + "Part": 0 }, { - "Text": "from the_big_box.whitehouse.gov ([192.168.51.50])\n by mailhost.whitehouse.gov (8.8.8/8.8.7) with ESMTP id RAA20366\n for vice-president@whitehouse.gov; Mon, 13 Aug 1998 17:42:41 +1000" + "Part": 1 } ] }, - "message_id": { - "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "return_path" - }, - "start": 639, - "end": 667 - }, - { - "name": { - "Rfc": "received" - }, - "start": 676, - "end": 893 - }, - { - "name": { - "Rfc": "received" - }, - "start": 902, - "end": 1100 - }, - { - "name": { - "Rfc": "date" - }, - "start": 1105, - "end": 1138 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 1149, - "end": 1198 - }, - { - "name": { - "Rfc": "from" - }, - "start": 1203, - "end": 1244 - }, - { - "name": { - "Rfc": "to" - }, - "start": 1247, - "end": 1303 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 1311, - "end": 1347 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 1360, - "end": 1365 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 1378, - "end": 1461 - } - ], - "html_body": [ - 0, - 1 - ], - "text_body": [ - 0, - 1 - ], - "attachments": [ - { - "Inline": 1 - } - ], - "parts": [ - { - "Text": { - "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - } - }, - "contents": "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.1one1yp1anet.com/dest/sam/graphics/map-arg.htm\n\nThen again, shouldn't the CIA have something like that?\n\nBill", - "is_html": false - } - }, - { - "Binary": { - "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "gif", - "attributes": { - "name": "map_of_Argentina.gif" - } - } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "attributes": { - "fi1ename": "map_of_Argentina.gif" - } - } - } - }, - "contents": [ - 71, - 77, - 70, - 56, - 61, - 97, - 37, - 0, - 53, - 0, - 162, - 0, - 0, - 255, - 255, - 255, - 255, - 251, - 240, - 255, - 232, - 154, - 125, - 125, - 125, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 44, - 0, - 0, - 0, - 0, - 37, - 0, - 53, - 0, - 0, - 3, - 237, - 8, - 186, - 220, - 254, - 112, - 192, - 73, - 163, - 4, - 34, - 235, - 157, - 9, - 225, - 96, - 40, - 12, - 215, - 8, - 126, - 166, - 72, - 42, - 169, - 224, - 189, - 94, - 187, - 173, - 152, - 25, - 187, - 132, - 2, - 183, - 180, - 253, - 245, - 128, - 87, - 0, - 136, - 82, - 149, - 66, - 177, - 133, - 71, - 169, - 44, - 114, - 122, - 39, - 77, - 238, - 197, - 0, - 6, - 157, - 26, - 232, - 38, - 70, - 237, - 194, - 154, - 32, - 109, - 231, - 183, - 236, - 86, - 173, - 216, - 209, - 81, - 74, - 158, - 150, - 29, - 196, - 240, - 186, - 51, - 182, - 94, - 225, - 202, - 231, - 156, - 123, - 166, - 226, - 131, - 122, - 44, - 82, - 117, - 110, - 126, - 77, - 93, - 51, - 123, - 56, - 94, - 95, - 66, - 67, - 121, - 89, - 138, - 48, - 4, - 67, - 118, - 118, - 65, - 144, - 25, - 98, - 109, - 75, - 58, - 134, - 76, - 128, - 137, - 130, - 116, - 46, - 76, - 147, - 127, - 88, - 155, - 40, - 141, - 167, - 125, - 169, - 115, - 46, - 132, - 133, - 157, - 141, - 114, - 163, - 99, - 139, - 94, - 158, - 58, - 58, - 182, - 53, - 108, - 178, - 77, - 160, - 105, - 106, - 183, - 184, - 99, - 87, - 83, - 166, - 70, - 198, - 199, - 178, - 147, - 196, - 154, - 176, - 108, - 55, - 39, - 209, - 145, - 205, - 212, - 208, - 147, - 45, - 98, - 28, - 219, - 220, - 60, - 211, - 72, - 225, - 50, - 222, - 41, - 215, - 204, - 191, - 45, - 47, - 50, - 162, - 235, - 34, - 219, - 238, - 197, - 240, - 214, - 242, - 230, - 227, - 185, - 224, - 237, - 38, - 231, - 243, - 238, - 43, - 72, - 8, - 28, - 72, - 72, - 160, - 193, - 131, - 8, - 19, - 42, - 60, - 152, - 0, - 0, - 59 - ] - } - } - ], - "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - } - ] - }, - "offset_header": 627, - "offset_body": 1462, - "offset_end": 2607 + "offset_header": 627, + "offset_body": 1462, + "offset_end": 2607 + } } } ], "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - } - ] + "Part": 0 }, "offset_header": 0, "offset_body": 270, diff --git a/tests/rfc/003.txt b/tests/rfc/003.txt index c43e6d8..090f656 100644 --- a/tests/rfc/003.txt +++ b/tests/rfc/003.txt @@ -26,14 +26,29 @@ Content-Type: application/x-whatever ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "boundary42" + } + } + }, + "subject": { + "Text": "Formatted text mail" + }, "to": { "Address": { "name": "Ned Freed", "address": "ned@innosoft.com" } }, - "subject": { - "Text": "Formatted text mail" + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" + } }, "date": { "DateTime": { @@ -48,23 +63,8 @@ Content-Type: application/x-whatever "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, "mime_version": { "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "boundary42" - } - } } }, "headers_offsets": [ @@ -118,12 +118,8 @@ Content-Type: application/x-whatever 0 ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 2 - } + 1, + 2 ], "parts": [ { @@ -139,8 +135,7 @@ Content-Type: application/x-whatever } } }, - "contents": "... plain text version of message goes here ...\n", - "is_html": false + "body": "... plain text version of message goes here ...\n" } }, { @@ -153,8 +148,7 @@ Content-Type: application/x-whatever } } }, - "contents": "... RFC 1896 text/enriched version of same message\n goes here ...\n", - "is_html": false + "body": "... RFC 1896 text/enriched version of same message\n goes here ...\n" } }, { @@ -167,7 +161,7 @@ Content-Type: application/x-whatever } } }, - "contents": [ + "body": [ 46, 46, 46, diff --git a/tests/rfc/004.txt b/tests/rfc/004.txt index 76fc4d1..ca32da0 100644 --- a/tests/rfc/004.txt +++ b/tests/rfc/004.txt @@ -37,28 +37,11 @@ Subject: my different opinion ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "---- main boundary ----" - } - } - }, - "mime_version": { - "Text": "1.0" - }, "from": { "Address": { "name": "Moderator-Address" } }, - "to": { - "Address": { - "name": "Recipient-List" - } - }, "date": { "DateTime": { "year": 1994, @@ -72,6 +55,23 @@ Subject: my different opinion "tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Recipient-List" + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "---- main boundary ----" + } + } + }, "subject": { "Text": "Internet Digest, volume 42" } @@ -127,18 +127,13 @@ Subject: my different opinion 0 ], "attachments": [ - { - "Attachment": 3 - }, - { - "Attachment": 5 - } + 2, + 3 ], "parts": [ { "Text": { - "contents": "...Introductory text or table of contents...\n", - "is_html": false + "body": "...Introductory text or table of contents...\n" } }, { @@ -155,164 +150,162 @@ Subject: my different opinion } }, { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" + "Message": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" + } } + }, + "body": { + "headers_rfc": { + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 26, + "hour": 11, + "minute": 13, + "second": 32, + "tz_before_gmt": false, + "tz_hour": 2, + "tz_minute": 0 + } + }, + "subject": { + "Text": "my opinion" + }, + "from": { + "Address": { + "name": "someone-else" + } + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 423, + "end": 437 + }, + { + "name": { + "Rfc": "date" + }, + "start": 442, + "end": 475 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 483, + "end": 495 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "...body goes here ...\n" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 418, + "offset_body": 496, + "offset_end": 545 } } }, { "Message": { - "headers_rfc": { - "subject": { - "Text": "my opinion" - }, - "from": { - "Address": { - "name": "someone-else" - } - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 26, - "hour": 11, - "minute": 13, - "second": 32, - "tz_before_gmt": false, - "tz_hour": 2, - "tz_minute": 0 + "headers": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" + "body": { + "headers_rfc": { + "from": { + "Address": { + "name": "someone-else-again" + } }, - "start": 423, - "end": 437 - }, - { - "name": { - "Rfc": "date" + "date": { + "DateTime": { + "year": 1993, + "month": 3, + "day": 26, + "hour": 10, + "minute": 7, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 5, + "tz_minute": 0 + } }, - "start": 442, - "end": 475 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 483, - "end": 495 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "...body goes here ...\n", - "is_html": false + "subject": { + "Text": "my different opinion" } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 418, - "offset_body": 496, - "offset_end": 545 - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 550, + "end": 570 + }, + { + "name": { + "Rfc": "date" + }, + "start": 575, + "end": 608 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 616, + "end": 638 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "... another body goes here ...\n" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 545, + "offset_body": 639, + "offset_end": 695 } } - }, - { - "Message": { - "headers_rfc": { - "subject": { - "Text": "my different opinion" - }, - "from": { - "Address": { - "name": "someone-else-again" - } - }, - "date": { - "DateTime": { - "year": 1993, - "month": 3, - "day": 26, - "hour": 10, - "minute": 7, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 5, - "tz_minute": 0 - } - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 550, - "end": 570 - }, - { - "name": { - "Rfc": "date" - }, - "start": 575, - "end": 608 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 616, - "end": 638 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "... another body goes here ...\n", - "is_html": false - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 545, - "offset_body": 639, - "offset_end": 695 - } } ], "structure": { @@ -323,14 +316,7 @@ Subject: my different opinion { "MultiPart": [ 1, - [ - { - "Part": 2 - }, - { - "Part": 4 - } - ] + [] ] } ] diff --git a/tests/rfc/005.txt b/tests/rfc/005.txt index d6d96bc..98231c4 100644 --- a/tests/rfc/005.txt +++ b/tests/rfc/005.txt @@ -26,6 +26,21 @@ This is the epilogue. It is also to be ignored. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } + }, "date": { "DateTime": { "year": 1993, @@ -39,24 +54,6 @@ This is the epilogue. It is also to be ignored. "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Sample message" - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -65,6 +62,9 @@ This is the epilogue. It is also to be ignored. "boundary": "simple boundary" } } + }, + "subject": { + "Text": "Sample message" } }, "headers_offsets": [ @@ -122,8 +122,7 @@ This is the epilogue. It is also to be ignored. "parts": [ { "Text": { - "contents": "This is implicitly typed plain US-ASCII text.\nIt does NOT end with a linebreak.", - "is_html": false + "body": "This is implicitly typed plain US-ASCII text.\nIt does NOT end with a linebreak." } }, { @@ -139,8 +138,7 @@ This is the epilogue. It is also to be ignored. } } }, - "contents": "This is explicitly typed plain US-ASCII text.\nIt DOES end with a linebreak.\n", - "is_html": false + "body": "This is explicitly typed plain US-ASCII text.\nIt DOES end with a linebreak.\n" } } ], diff --git a/tests/rfc/006.txt b/tests/rfc/006.txt index a5f0c76..d79f19d 100644 --- a/tests/rfc/006.txt +++ b/tests/rfc/006.txt @@ -24,18 +24,6 @@ Content-Disposition: inline ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "boundary-string" - } - } - }, - "subject": { - "Text": "Multipart Email Example" - }, "to": { "Address": { "address": "recipient@example.com" @@ -45,6 +33,18 @@ Content-Disposition: inline "Address": { "address": "sender@example.com" } + }, + "subject": { + "Text": "Multipart Email Example" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "boundary-string" + } + } } }, "headers_offsets": [ @@ -105,12 +105,11 @@ Content-Disposition: inline } } }, - "contents": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n", - "is_html": false + "body": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n" } }, { - "Text": { + "Html": { "headers": { "content_disposition": { "ContentType": { @@ -130,8 +129,7 @@ Content-Disposition: inline "Text": "quoted-printable" } }, - "contents": "

This is the HTML Section!

\n

This is what displays in most modern email clients

\n", - "is_html": true + "body": "

This is the HTML Section!

\n

This is what displays in most modern email clients

\n" } } ], diff --git a/tests/rfc/007.txt b/tests/rfc/007.txt index 4910a65..2e9f26f 100644 --- a/tests/rfc/007.txt +++ b/tests/rfc/007.txt @@ -106,50 +106,39 @@ K "html_body": [ 0, 8, - 14 + 13 ], "text_body": [ 0, 4, 5, 6, - 14 + 13 ], "attachments": [ - { - "Inline": 5 - }, - { - "Attachment": 9 - }, - { - "Attachment": 10 - }, - { - "Attachment": 11 - }, - { - "Attachment": 13 - } + 5, + 9, + 10, + 11, + 12 ], "parts": [ { "Text": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline" + } + }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } } }, - "contents": "A", - "is_html": false + "body": "A" } }, { @@ -206,26 +195,25 @@ K } } }, - "contents": "B", - "is_html": false + "body": "B" } }, { - "Binary": { + "InlineBinary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline" + } + }, "content_type": { "ContentType": { "c_type": "image", "c_subtype": "jpeg" } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline" - } } }, - "contents": [ + "body": [ 67 ] } @@ -245,8 +233,7 @@ K } } }, - "contents": "D", - "is_html": false + "body": "D" } }, { @@ -263,7 +250,7 @@ K } }, { - "Text": { + "Html": { "headers": { "content_type": { "ContentType": { @@ -272,8 +259,7 @@ K } } }, - "contents": "E", - "is_html": true + "body": "E" } }, { @@ -286,7 +272,7 @@ K } } }, - "contents": [ + "body": [ 70 ] } @@ -294,19 +280,19 @@ K { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "attachment" - } - }, "content_type": { "ContentType": { "c_type": "image", "c_subtype": "jpeg" } + }, + "content_disposition": { + "ContentType": { + "c_type": "attachment" + } } }, - "contents": [ + "body": [ 71 ] } @@ -321,57 +307,56 @@ K } } }, - "contents": [ + "body": [ 72 ] } }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } - } - }, { "Message": { - "headers_rfc": { - "subject": { - "Text": "J" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 789, - "end": 792 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "J", - "is_html": false + "headers": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } - ], - "structure": { - "Part": 0 }, - "offset_header": 781, - "offset_body": 793, - "offset_end": 798 + "body": { + "headers_rfc": { + "subject": { + "Text": "J" + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "subject" + }, + "start": 789, + "end": 792 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "J" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 781, + "offset_body": 793, + "offset_end": 798 + } } }, { @@ -389,8 +374,7 @@ K } } }, - "contents": "K", - "is_html": false + "body": "K" } } ], @@ -444,15 +428,12 @@ K }, { "Part": 11 - }, - { - "Part": 12 } ] ] }, { - "Part": 14 + "Part": 13 } ] }, diff --git a/tests/thirdparty/000.txt b/tests/thirdparty/000.txt index b61146a..05282f2 100644 --- a/tests/thirdparty/000.txt +++ b/tests/thirdparty/000.txt @@ -21,6 +21,9 @@ ZWg= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -29,9 +32,6 @@ ZWg= "boundary": "bound" } } - }, - "mime_version": { - "Text": "1.0" } }, "headers_offsets": [ @@ -62,35 +62,33 @@ ZWg= { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain" } - }, - "content_transfer_encoding": { - "Text": "base64" } }, - "contents": "we have\ra lot \nof \u0000binary stuff in here\nb adjig sadjg jasidgjiaehga3wht8a3w8ghxjc dsgad hasdghsd gasd dsjdsoga sjdga0w3tjhawjgsertniq3n5oqerjqw2r89q23h awhrqh835r8a", - "is_html": false + "body": "we have\ra lot \nof \u0000binary stuff in here\nb adjig sadjg jasidgjiaehga3wht8a3w8ghxjc dsgad hasdghsd gasd dsjdsoga sjdga0w3tjhawjgsertniq3n5oqerjqw2r89q23h awhrqh835r8a" } }, { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain" } + }, + "content_transfer_encoding": { + "Text": "base64" } }, - "contents": "eh", - "is_html": false + "body": "eh" } } ], diff --git a/tests/thirdparty/001.txt b/tests/thirdparty/001.txt index 134b4e0..40b566f 100644 --- a/tests/thirdparty/001.txt +++ b/tests/thirdparty/001.txt @@ -26,6 +26,9 @@ hello world ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -34,9 +37,6 @@ hello world "boundary": "bound" } } - }, - "mime_version": { - "Text": "1.0" } }, "headers_offsets": [ @@ -79,8 +79,7 @@ hello world "Text": "binary" } }, - "contents": "d2UgaGF2ZQ1hIGxvdCAKb2YgAGJpbmFyeSBzdHVmZiBpbiBoZXJlCmIgYWRqaWcgc2FkamcgamFz\r\naWRnamlhZWhnYTN3aHQ4YTN3OGdoeGpjIGRzZ2FkIGhhc2RnaHNkIGdhc2QgZHNqZHNvZ2Egc2pk\r\nZ2EwdzN0amhhd2pnc2VydG5pcTNuNW9xZXJqcXcycjg5cTIzaCBhd2hycWg4MzVyOGE=\r", - "is_html": false + "body": "d2UgaGF2ZQ1hIGxvdCAKb2YgAGJpbmFyeSBzdHVmZiBpbiBoZXJlCmIgYWRqaWcgc2FkamcgamFz\r\naWRnamlhZWhnYTN3aHQ4YTN3OGdoeGpjIGRzZ2FkIGhhc2RnaHNkIGdhc2QgZHNqZHNvZ2Egc2pk\r\nZ2EwdzN0amhhd2pnc2VydG5pcTNuNW9xZXJqcXcycjg5cTIzaCBhd2hycWg4MzVyOGE=\r" } }, { @@ -96,8 +95,7 @@ hello world } } }, - "contents": "ZWg=", - "is_html": false + "body": "ZWg=" } }, { @@ -110,8 +108,7 @@ hello world } } }, - "contents": "hello world\r\n\r", - "is_html": false + "body": "hello world\r\n\r" } } ], diff --git a/tests/thirdparty/002.txt b/tests/thirdparty/002.txt index 30d4ebf..45cb278 100644 --- a/tests/thirdparty/002.txt +++ b/tests/thirdparty/002.txt @@ -49,36 +49,14 @@ Content-Type: text/plain; charset=utf-8 1 ], "attachments": [ - { - "Attachment": 2 - } + 2 ], "parts": [ { "Text": { "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-8" - } - } - }, "content_transfer_encoding": { "Text": "quoted-printable" - } - }, - "contents": "päivää\n", - "is_html": false - } - }, - { - "Text": { - "headers": { - "content_transfer_encoding": { - "Text": "base64" }, "content_type": { "ContentType": { @@ -90,8 +68,7 @@ Content-Type: text/plain; charset=utf-8 } } }, - "contents": "yötä vaan.\n�\t�", - "is_html": false + "body": "päivää\n" } }, { @@ -110,8 +87,26 @@ Content-Type: text/plain; charset=utf-8 "Text": "base64" } }, - "contents": "?garbage", - "is_html": false + "body": "yötä vaan.\n�\t�" + } + }, + { + "Text": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-8" + } + } + }, + "content_transfer_encoding": { + "Text": "base64" + } + }, + "body": "?garbage" } } ], diff --git a/tests/thirdparty/003.txt b/tests/thirdparty/003.txt index 7be3665..83fb0c8 100644 --- a/tests/thirdparty/003.txt +++ b/tests/thirdparty/003.txt @@ -36,9 +36,6 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -47,6 +44,9 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "boundary": "1" } } + }, + "mime_version": { + "Text": "1.0" } }, "headers_offsets": [ @@ -96,8 +96,7 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "Text": "7bit" } }, - "contents": "Move black king to queen's bishop\n", - "is_html": false + "body": "Move black king to queen's bishop\n" } }, { @@ -116,8 +115,7 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== } } }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false + "body": "Move ♚ to ♛'s ♝\n" } }, { @@ -136,16 +134,12 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "Text": "8bit" } }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false + "body": "Move ♚ to ♛'s ♝\n" } }, { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -154,10 +148,12 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "charset": "UTF-8" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false + "body": "Move ♚ to ♛'s ♝\n" } }, { @@ -176,8 +172,7 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "Text": "base64" } }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false + "body": "Move ♚ to ♛'s ♝\n" } } ], diff --git a/tests/thirdparty/004.txt b/tests/thirdparty/004.txt index 55e3130..435428c 100644 --- a/tests/thirdparty/004.txt +++ b/tests/thirdparty/004.txt @@ -42,6 +42,9 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -50,9 +53,6 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "boundary": "1" } } - }, - "mime_version": { - "Text": "1.0" } }, "headers_offsets": [ @@ -91,26 +91,9 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "UTF-8" - } - } - }, "content_transfer_encoding": { "Text": "6bit" - } - }, - "contents": "Move black king to queen's bishop\n", - "is_html": false - } - }, - { - "Text": { - "headers": { + }, "content_type": { "ContentType": { "c_type": "text", @@ -119,18 +102,17 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "charset": "UTF-8" } } - }, + } + }, + "body": "Move black king to queen's bishop\n" + } + }, + { + "Text": { + "headers": { "content_transfer_encoding": { "Text": "7bits" - } - }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false - } - }, - { - "Text": { - "headers": { + }, "content_type": { "ContentType": { "c_type": "text", @@ -139,13 +121,28 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "charset": "UTF-8" } } - }, - "content_transfer_encoding": { - "Text": "8 bit" } }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false + "body": "Move ♚ to ♛'s ♝\n" + } + }, + { + "Text": { + "headers": { + "content_transfer_encoding": { + "Text": "8 bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "UTF-8" + } + } + } + }, + "body": "Move ♚ to ♛'s ♝\n" } }, { @@ -164,8 +161,7 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D } } }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false + "body": "Move ♚ to ♛'s ♝\n" } }, { @@ -184,8 +180,7 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D } } }, - "contents": "Move ♚ to ♛'s ♝\n", - "is_html": false + "body": "Move ♚ to ♛'s ♝\n" } }, { @@ -201,8 +196,7 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D } } }, - "contents": "Move =E2=99=9A to =E2=99=9B's =E2=99=9D\n", - "is_html": false + "body": "Move =E2=99=9A to =E2=99=9B's =E2=99=9D\n" } } ], diff --git a/tests/thirdparty/005.txt b/tests/thirdparty/005.txt index fae7c0a..d2ce0b4 100644 Binary files a/tests/thirdparty/005.txt and b/tests/thirdparty/005.txt differ diff --git a/tests/thirdparty/006.txt b/tests/thirdparty/006.txt index 03afd08..3deb560 100644 --- a/tests/thirdparty/006.txt +++ b/tests/thirdparty/006.txt @@ -31,6 +31,9 @@ Signed by undersigned ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "subject": { "Text": "Hide and seek" }, @@ -42,9 +45,6 @@ Signed by undersigned "boundary": "1" } } - }, - "mime_version": { - "Text": "1.0" } }, "headers_offsets": [ @@ -77,9 +77,7 @@ Signed by undersigned 3 ], "attachments": [ - { - "Attachment": 4 - } + 4 ], "parts": [ { @@ -89,9 +87,9 @@ Signed by undersigned "c_type": "multipart", "c_subtype": "signed", "attributes": { - "protocol": "signature/plain", "migalc": "pen+paper", - "boundary": "2" + "boundary": "2", + "protocol": "signature/plain" } } } @@ -111,7 +109,7 @@ Signed by undersigned } }, { - "Text": { + "Html": { "headers": { "content_type": { "ContentType": { @@ -123,8 +121,7 @@ Signed by undersigned } } }, - "contents": "Search me

Don't find me here

\n", - "is_html": true + "body": "Search me

Don't find me here

\n" } }, { @@ -140,8 +137,7 @@ Signed by undersigned } } }, - "contents": "Search me, and Find me here", - "is_html": false + "body": "Search me, and Find me here" } }, { @@ -157,7 +153,7 @@ Signed by undersigned } } }, - "contents": [ + "body": [ 83, 105, 103, diff --git a/tests/thirdparty/007.txt b/tests/thirdparty/007.txt index b610d9f..0943a82 100644 --- a/tests/thirdparty/007.txt +++ b/tests/thirdparty/007.txt @@ -68,279 +68,258 @@ Foobar } ], "attachments": [ - { - "Attachment": 1 - }, - { - "Attachment": 3 - }, - { - "Attachment": 5 - } + 0, + 1, + 2 ], "parts": [ - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } - } - }, { "Message": { - "headers_rfc": { - "from": { - "Address": { - "name": "someone-else", - "address": "someone@else" - } - }, - "subject": { - "Text": "my opinion" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 92, - "end": 121 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 129, - "end": 141 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "This is my opinion", - "is_html": false - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 87, - "offset_body": 142, - "offset_end": 166 - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } - } - }, - { - "Message": { - "headers_rfc": { - "subject": { - "Text": "i disagree" - }, - "from": { - "Address": { - "name": "another one", - "address": "another@one" - } - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 171, - "end": 198 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 206, - "end": 218 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "parts": [ - { - "Text": { - "contents": "Not agreeing one bit!", - "is_html": false - } - } - ], - "structure": { - "Part": 0 - }, - "offset_header": 166, - "offset_body": 219, - "offset_end": 246 - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } - } - }, - { - "Message": { - "headers_rfc": { - "subject": { - "Text": "funny hat" - }, + "headers": { "content_type": { "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" + "c_type": "message", + "c_subtype": "rfc822" + } + } + }, + "body": { + "headers_rfc": { + "subject": { + "Text": "my opinion" + }, + "from": { + "Address": { + "name": "someone-else", + "address": "someone@else" } } }, - "from": { - "Address": { - "name": "attachment", - "address": "attachment@user" + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 92, + "end": 121 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 129, + "end": 141 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "This is my opinion" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 87, + "offset_body": 142, + "offset_end": 166 + } + } + }, + { + "Message": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" } } }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" + "body": { + "headers_rfc": { + "subject": { + "Text": "i disagree" }, - "start": 251, - "end": 281 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 289, - "end": 300 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 313, - "end": 342 - } - ], - "html_body": [ - 0 - ], - "text_body": [ - 0 - ], - "attachments": [ - { - "Attachment": 1 - } - ], - "parts": [ - { - "Text": { - "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain" - } - }, - "content_transfer_encoding": { - "Text": "binary" - } - }, - "contents": "Lovely attachment for you", - "is_html": false + "from": { + "Address": { + "name": "another one", + "address": "another@one" + } } }, - { - "Binary": { - "headers": { - "content_transfer_encoding": { - "Text": "binary" - }, - "content_type": { - "ContentType": { - "c_type": "application", - "c_subtype": "octet-stream", - "attributes": { - "name": "test.txt", - "disposition": "attachment" + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 171, + "end": 198 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 206, + "end": 218 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "parts": [ + { + "Text": { + "body": "Not agreeing one bit!" + } + } + ], + "structure": { + "Part": 0 + }, + "offset_header": 166, + "offset_body": 219, + "offset_end": 246 + } + } + }, + { + "Message": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822" + } + } + }, + "body": { + "headers_rfc": { + "subject": { + "Text": "funny hat" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" + } + } + }, + "from": { + "Address": { + "name": "attachment", + "address": "attachment@user" + } + } + }, + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 251, + "end": 281 + }, + { + "name": { + "Rfc": "subject" + }, + "start": 289, + "end": 300 + }, + { + "name": { + "Rfc": "content_type" + }, + "start": 313, + "end": 342 + } + ], + "html_body": [ + 0 + ], + "text_body": [ + 0 + ], + "attachments": [ + 1 + ], + "parts": [ + { + "Text": { + "headers": { + "content_transfer_encoding": { + "Text": "binary" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain" } } - } - }, - "contents": [ - 70, - 111, - 111, - 98, - 97, - 114 - ] - } - } - ], - "structure": { - "List": [ - { - "Part": 0 + }, + "body": "Lovely attachment for you" + } }, { - "Part": 1 + "Binary": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "application", + "c_subtype": "octet-stream", + "attributes": { + "disposition": "attachment", + "name": "test.txt" + } + } + }, + "content_transfer_encoding": { + "Text": "binary" + } + }, + "body": [ + 70, + 111, + 111, + 98, + 97, + 114 + ] + } } - ] - }, - "offset_header": 246, - "offset_body": 343, - "offset_end": 565 + ], + "structure": { + "List": [ + { + "Part": 0 + }, + { + "Part": 1 + } + ] + }, + "offset_header": 246, + "offset_body": 343, + "offset_end": 565 + } } } ], "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 2 - }, - { - "Part": 4 - } - ] + "List": [] }, "offset_header": 0, "offset_body": 82, diff --git a/tests/thirdparty/008.txt b/tests/thirdparty/008.txt index f6d3391..266cb37 100644 --- a/tests/thirdparty/008.txt +++ b/tests/thirdparty/008.txt @@ -63,6 +63,18 @@ Root MIME epilogue "address": "user@domain.org" } }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "foo bar" + } + } + }, + "mime_version": { + "Text": "1.0" + }, "date": { "DateTime": { "year": 2007, @@ -75,18 +87,6 @@ Root MIME epilogue "tz_hour": 2, "tz_minute": 0 } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "foo bar" - } - } } }, "headers_other": { @@ -132,18 +132,14 @@ Root MIME epilogue } ], "html_body": [ - 3 + 2 ], "text_body": [ - 3 + 2 ], "attachments": [ - { - "Attachment": 0 - }, - { - "Attachment": 2 - } + 0, + 1 ], "parts": [ { @@ -159,186 +155,181 @@ Root MIME epilogue } } }, - "contents": "hello\n", - "is_html": false - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822" - } - } + "body": "hello\n" } }, { "Message": { - "headers_rfc": { - "subject": { - "Text": "submsg" - }, - "from": { - "Address": { - "address": "sub@domain.org" - } - }, - "date": { - "DateTime": { - "year": 2012, - "month": 8, - "day": 12, - "hour": 12, - "minute": 34, - "second": 56, - "tz_before_gmt": false, - "tz_hour": 3, - "tz_minute": 0 - } - }, + "headers": { "content_type": { "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub1" - } + "c_type": "message", + "c_subtype": "rfc822" } } }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" + "body": { + "headers_rfc": { + "from": { + "Address": { + "address": "sub@domain.org" + } }, - "start": 300, - "end": 316 + "subject": { + "Text": "submsg" + }, + "date": { + "DateTime": { + "year": 2012, + "month": 8, + "day": 12, + "hour": 12, + "minute": 34, + "second": 56, + "tz_before_gmt": false, + "tz_hour": 3, + "tz_minute": 0 + } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub1" + } + } + } }, - { - "name": { - "Rfc": "date" + "headers_offsets": [ + { + "name": { + "Rfc": "from" + }, + "start": 300, + "end": 316 }, - "start": 321, - "end": 354 - }, - { - "name": { - "Rfc": "subject" + { + "name": { + "Rfc": "date" + }, + "start": 321, + "end": 354 }, - "start": 362, - "end": 370 - }, - { - "name": { - "Rfc": "content_type" + { + "name": { + "Rfc": "subject" + }, + "start": 362, + "end": 370 }, - "start": 383, - "end": 423 - } - ], - "html_body": [ - 0, - 4 - ], - "text_body": [ - 3, - 4, - 5 - ], - "parts": [ - { - "Text": { - "headers": { + { + "name": { + "Rfc": "content_type" + }, + "start": 383, + "end": 423 + } + ], + "html_body": [ + 0, + 4 + ], + "text_body": [ + 3, + 4, + 5 + ], + "parts": [ + { + "Html": { + "headers": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html" + } + } + }, + "body": "

Hello world

\n" + } + }, + { + "Multipart": { "content_type": { "ContentType": { - "c_type": "text", - "c_subtype": "html" - } - } - }, - "contents": "

Hello world

\n", - "is_html": true - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub2" + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub2" + } } } } - } - }, - { - "Multipart": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "sub3" - } - } - } - } - }, - { - "Text": { - "contents": "sub3 text", - "is_html": false - } - }, - { - "Text": { - "contents": "sub3 text2", - "is_html": false - } - }, - { - "Text": { - "contents": "sub2 text2", - "is_html": false - } - } - ], - "structure": { - "List": [ - { - "Part": 0 }, { - "MultiPart": [ - 1, - [ - { - "MultiPart": [ - 2, - [ - { - "Part": 3 - }, - { - "Part": 4 - } - ] - ] - }, - { - "Part": 5 + "Multipart": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "sub3" + } } - ] - ] + } + } + }, + { + "Text": { + "body": "sub3 text" + } + }, + { + "Text": { + "body": "sub3 text2" + } + }, + { + "Text": { + "body": "sub2 text2" + } } - ] - }, - "offset_header": 295, - "offset_body": 424, - "offset_end": 710 + ], + "structure": { + "List": [ + { + "Part": 0 + }, + { + "MultiPart": [ + 1, + [ + { + "MultiPart": [ + 2, + [ + { + "Part": 3 + }, + { + "Part": 4 + } + ] + ] + }, + { + "Part": 5 + } + ] + ] + } + ] + }, + "offset_header": 295, + "offset_body": 424, + "offset_end": 710 + } } }, { @@ -351,8 +342,7 @@ Root MIME epilogue } } }, - "contents": "Another part", - "is_html": false + "body": "Another part" } } ], @@ -362,10 +352,7 @@ Root MIME epilogue "Part": 0 }, { - "Part": 1 - }, - { - "Part": 3 + "Part": 2 } ] }, diff --git a/tests/thirdparty/009.txt b/tests/thirdparty/009.txt index 1e489ad..a321c0a 100644 --- a/tests/thirdparty/009.txt +++ b/tests/thirdparty/009.txt @@ -22,12 +22,6 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "In parts" - }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -36,6 +30,12 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= "boundary": "1" } } + }, + "subject": { + "Text": "In parts" + }, + "mime_version": { + "Text": "1.0" } }, "headers_offsets": [ @@ -68,9 +68,7 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= 0 ], "attachments": [ - { - "Attachment": 1 - } + 1 ], "parts": [ { @@ -86,8 +84,7 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= } } }, - "contents": "Hi, this is the fancy thing I was talking about!", - "is_html": false + "body": "Hi, this is the fancy thing I was talking about!" } }, { @@ -98,14 +95,14 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= "c_type": "message", "c_subtype": "partial", "attributes": { - "number": "1", + "id": "heks68ewe@example.org", "total": "5", - "id": "heks68ewe@example.org" + "number": "1" } } } }, - "contents": [ + "body": [ 88, 45, 87, diff --git a/tests/thirdparty/010.txt b/tests/thirdparty/010.txt index 8cfc56d..391d40f 100644 --- a/tests/thirdparty/010.txt +++ b/tests/thirdparty/010.txt @@ -13,9 +13,6 @@ Content-Language: ja ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "こんにちは" - }, "mime_version": { "Text": "1.0" }, @@ -24,10 +21,13 @@ Content-Language: ja "c_type": "multipart", "c_subtype": "mixed", "attributes": { - "comment": "人権の無視及", - "boundary": "1" + "boundary": "1", + "comment": "人権の無視及" } } + }, + "subject": { + "Text": "こんにちは" } }, "headers_offsets": [ @@ -63,21 +63,20 @@ Content-Language: ja { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "binary" - }, - "content_language": { - "Text": "ja" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain" } + }, + "content_language": { + "Text": "ja" + }, + "content_transfer_encoding": { + "Text": "binary" } }, - "contents": "人権の無視及", - "is_html": false + "body": "人権の無視及" } } ],