diff --git a/README.md b/README.md index 6d02704..8c8f3b1 100644 --- a/README.md +++ b/README.md @@ -80,34 +80,26 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 // Parses addresses (including comments), lists and groups assert_eq!( message.get_from(), - &HeaderValue::Address(Addr { - name: Some("Art Vandelay (Vandelay Industries)".into()), - address: Some("art@vandelay.com".into()) - }) + &HeaderValue::Address(Addr::new( + "Art Vandelay (Vandelay Industries)".into(), + "art@vandelay.com" + )) ); + assert_eq!( message.get_to(), &HeaderValue::GroupList(vec![ - Group { - name: Some("Colleagues".into()), - addresses: vec![Addr { - name: Some("James Smythe".into()), - address: Some("james@vandelay.com".into()) - }] - }, - Group { - name: Some("Friends".into()), - addresses: vec![ - Addr { - name: None, - address: Some("jane@example.com".into()) - }, - Addr { - name: Some("John Smîth".into()), - address: Some("john@example.com".into()) - } + Group::new( + "Colleagues", + vec![Addr::new("James Smythe".into(), "james@vandelay.com")] + ), + Group::new( + "Friends", + vec![ + Addr::new(None, "jane@example.com"), + Addr::new("John Smîth".into(), "john@example.com"), ] - } + ) ]) ); diff --git a/examples/export_to_json_and_yaml.rs b/examples/export_to_json_and_yaml.rs index ebae1f3..7651575 100644 --- a/examples/export_to_json_and_yaml.rs +++ b/examples/export_to_json_and_yaml.rs @@ -58,34 +58,26 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 // Parses addresses (including comments), lists and groups assert_eq!( message.get_from(), - &HeaderValue::Address(Addr { - name: Some("Art Vandelay (Vandelay Industries)".into()), - address: Some("art@vandelay.com".into()) - }) + &HeaderValue::Address(Addr::new( + "Art Vandelay (Vandelay Industries)".into(), + "art@vandelay.com" + )) ); + assert_eq!( message.get_to(), &HeaderValue::GroupList(vec![ - Group { - name: Some("Colleagues".into()), - addresses: vec![Addr { - name: Some("James Smythe".into()), - address: Some("james@vandelay.com".into()) - }] - }, - Group { - name: Some("Friends".into()), - addresses: vec![ - Addr { - name: None, - address: Some("jane@example.com".into()) - }, - Addr { - name: Some("John Smîth".into()), - address: Some("john@example.com".into()) - } + Group::new( + "Colleagues", + vec![Addr::new("James Smythe".into(), "james@vandelay.com")] + ), + Group::new( + "Friends", + vec![ + Addr::new(None, "jane@example.com"), + Addr::new("John Smîth".into(), "john@example.com"), ] - } + ) ]) ); diff --git a/src/lib.rs b/src/lib.rs index aac7a24..c9b1757 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -159,34 +159,26 @@ //! // Parses addresses (including comments), lists and groups //! assert_eq!( //! message.get_from(), -//! &HeaderValue::Address(Addr { -//! name: Some("Art Vandelay (Vandelay Industries)".into()), -//! address: Some("art@vandelay.com".into()) -//! }) +//! &HeaderValue::Address(Addr::new( +//! "Art Vandelay (Vandelay Industries)".into(), +//! "art@vandelay.com" +//! )) //! ); +//! //! assert_eq!( //! message.get_to(), //! &HeaderValue::GroupList(vec![ -//! Group { -//! name: Some("Colleagues".into()), -//! addresses: vec![Addr { -//! name: Some("James Smythe".into()), -//! address: Some("james@vandelay.com".into()) -//! }] -//! }, -//! Group { -//! name: Some("Friends".into()), -//! addresses: vec![ -//! Addr { -//! name: None, -//! address: Some("jane@example.com".into()) -//! }, -//! Addr { -//! name: Some("John Smîth".into()), -//! address: Some("john@example.com".into()) -//! } +//! Group::new( +//! "Colleagues", +//! vec![Addr::new("James Smythe".into(), "james@vandelay.com")] +//! ), +//! Group::new( +//! "Friends", +//! vec![ +//! Addr::new(None, "jane@example.com"), +//! Addr::new("John Smîth".into(), "john@example.com"), //! ] -//! } +//! ) //! ]) //! ); //! @@ -273,9 +265,8 @@ pub struct Message<'x> { #[cfg_attr(feature = "serde_support", serde(default))] pub headers_rfc: RfcHeaders<'x>, #[cfg_attr(feature = "serde_support", serde(default))] - pub headers_other: OtherHeaders<'x>, - #[cfg_attr(feature = "serde_support", serde(default))] - pub headers_offsets: Vec>, + #[cfg_attr(feature = "serde_support", serde(skip))] + pub headers_raw: RawHeaders<'x>, #[cfg_attr(feature = "serde_support", serde(default))] pub html_body: Vec, @@ -420,6 +411,22 @@ pub struct Addr<'x> { pub address: Option>, } +impl<'x> Addr<'x> { + pub fn new(name: Option<&'x str>, address: &'x str) -> Self { + Self { + name: name.map(|name| name.into()), + address: Some(address.into()), + } + } + + pub fn into_owned<'y>(self) -> Addr<'y> { + Addr { + name: self.name.map(|s| s.into_owned().into()), + address: self.address.map(|s| s.into_owned().into()), + } + } +} + /// An RFC5322 address group. #[derive(Debug, PartialEq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] @@ -433,19 +440,34 @@ pub struct Group<'x> { pub addresses: Vec>, } +impl<'x> Group<'x> { + pub fn new(name: &'x str, addresses: Vec>) -> Self { + Self { + name: Some(name.into()), + addresses, + } + } + + pub fn into_owned<'y>(self) -> Group<'y> { + Group { + name: self.name.map(|s| s.into_owned().into()), + addresses: self.addresses.into_iter().map(|a| a.into_owned()).collect(), + } + } +} + pub type RfcHeaders<'x> = HashMap>; -pub type OtherHeaders<'x> = HashMap, HeaderValue<'x>>; +pub type RawHeaders<'x> = HashMap, Vec>; /// Offset of a message element in the raw message. -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] -pub struct HeaderOffset<'x> { - pub name: HeaderOffsetName<'x>, +pub struct HeaderOffset { pub start: usize, pub end: usize, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub enum HeaderOffsetName<'x> { Rfc(HeaderName), @@ -544,22 +566,22 @@ impl<'x> HeaderValue<'x> { *self == HeaderValue::Empty } - pub fn unwrap_text(&mut self) -> Cow<'x, str> { - match std::mem::take(self) { + pub fn unwrap_text(self) -> Cow<'x, str> { + match self { HeaderValue::Text(s) => s, _ => panic!("HeaderValue::unwrap_text called on non-Text value"), } } - pub fn unwrap_datetime(&mut self) -> DateTime { - match std::mem::take(self) { + pub fn unwrap_datetime(self) -> DateTime { + match self { HeaderValue::DateTime(d) => d, _ => panic!("HeaderValue::unwrap_datetime called on non-DateTime value"), } } - pub fn unwrap_content_type(&mut self) -> ContentType<'x> { - match std::mem::take(self) { + pub fn unwrap_content_type(self) -> ContentType<'x> { + match self { HeaderValue::ContentType(c) => c, _ => panic!("HeaderValue::unwrap_content_type called on non-ContentType value"), } @@ -593,6 +615,40 @@ impl<'x> HeaderValue<'x> { _ => None, } } + + pub fn into_owned<'y>(self) -> HeaderValue<'y> { + match self { + HeaderValue::Address(addr) => HeaderValue::Address(addr.into_owned()), + HeaderValue::AddressList(list) => { + HeaderValue::AddressList(list.into_iter().map(|addr| addr.into_owned()).collect()) + } + HeaderValue::Group(group) => HeaderValue::Group(group.into_owned()), + HeaderValue::GroupList(list) => { + HeaderValue::GroupList(list.into_iter().map(|group| group.into_owned()).collect()) + } + HeaderValue::Text(text) => HeaderValue::Text(text.into_owned().into()), + HeaderValue::TextList(list) => HeaderValue::TextList( + list.into_iter() + .map(|text| text.into_owned().into()) + .collect(), + ), + HeaderValue::DateTime(datetime) => HeaderValue::DateTime(datetime), + HeaderValue::ContentType(ct) => HeaderValue::ContentType(ContentType { + c_type: ct.c_type.into_owned().into(), + c_subtype: ct.c_subtype.map(|s| s.into_owned().into()), + attributes: ct.attributes.map(|attributes| { + attributes + .into_iter() + .map(|(k, v)| (k.into_owned().into(), v.into_owned().into())) + .collect() + }), + }), + HeaderValue::Collection(list) => { + HeaderValue::Collection(list.into_iter().map(|v| v.into_owned()).collect()) + } + HeaderValue::Empty => HeaderValue::Empty, + } + } } /// An RFC2047 Content-Type or RFC2183 Content-Disposition MIME header field. @@ -830,7 +886,8 @@ impl<'x> Message<'x> { .and_then(|header| header.as_text_ref()) } - /// Returns the message thread name + /// Returns the message thread name or 'base subject' as defined in + /// [RFC 5957 - Internet Message Access Protocol - SORT and THREAD Extensions (Section 2.1)](https://datatracker.ietf.org/doc/html/rfc5256#section-2.1) pub fn get_thread_name(&self) -> Option<&str> { thread_name(self.get_subject()?).into() } @@ -842,11 +899,25 @@ impl<'x> Message<'x> { .unwrap_or(&HeaderValue::Empty) } - /// Returns a non-standard header field - pub fn get_other(&self, name: &'x str) -> &HeaderValue<'x> { - self.headers_other - .get(&Cow::from(name)) - .unwrap_or(&HeaderValue::Empty) + pub fn _get_raw(&'x self, name: HeaderOffsetName) -> Option>> { + self.headers_raw + .get(&name)? + .iter() + .map(|offset| { + String::from_utf8_lossy(self.raw_message.get(offset.start..offset.end).unwrap()) + }) + .collect::>>() + .into() + } + + /// Returns in raw format a header field not defined in the conformed RFCs + pub fn get_other_header(&'x self, name: &str) -> Option>> { + self._get_raw(HeaderOffsetName::Other(name.into())) + } + + /// Returns in raw format a header field defined in the conformed RFCs + pub fn get_rfc_header(&'x self, name: HeaderName) -> Option>> { + self._get_raw(HeaderOffsetName::Rfc(name)) } fn get_part(&self, list: &'x [MessagePartId], pos: usize) -> Option<&'x dyn BodyPart> { diff --git a/src/parsers/header.rs b/src/parsers/header.rs index 5080557..46c9a0e 100644 --- a/src/parsers/header.rs +++ b/src/parsers/header.rs @@ -11,12 +11,17 @@ use std::{borrow::Cow, collections::hash_map::Entry}; -use crate::{HeaderName, HeaderOffset, HeaderOffsetName, HeaderValue, OtherHeaders, RfcHeaders}; +use crate::{HeaderName, HeaderOffset, HeaderOffsetName, HeaderValue, RawHeaders, RfcHeaders}; use super::{ fields::{ - address::parse_address, content_type::parse_content_type, date::parse_date, id::parse_id, - list::parse_comma_separared, raw::parse_raw, unstructured::parse_unstructured, + address::parse_address, + content_type::parse_content_type, + date::parse_date, + id::parse_id, + list::parse_comma_separared, + raw::{parse_and_ignore, parse_raw}, + unstructured::parse_unstructured, }, message::MessageStream, }; @@ -31,8 +36,7 @@ pub enum HeaderParserResult<'x> { pub fn parse_headers<'x>( headers_rfc: &mut RfcHeaders<'x>, - mut headers_other: Option<&mut OtherHeaders<'x>>, - mut headers_offsets: Option<&mut Vec>>, + mut headers_raw: Option<&mut RawHeaders<'x>>, stream: &mut MessageStream<'x>, ) -> bool { loop { @@ -45,12 +49,14 @@ pub fn parse_headers<'x>( let from_offset = stream.pos; let value = parser(stream); - if let Some(headers_offsets) = headers_offsets.as_mut() { - headers_offsets.push(HeaderOffset { - name: HeaderOffsetName::Rfc(name), - start: from_offset, - end: stream.pos, - }); + if let Some(headers_raw) = headers_raw.as_mut() { + headers_raw + .entry(HeaderOffsetName::Rfc(name)) + .or_insert_with(Vec::new) + .push(HeaderOffset { + start: from_offset, + end: stream.pos, + }); } if !value.is_empty() { @@ -77,35 +83,16 @@ pub fn parse_headers<'x>( } } HeaderParserResult::Other(name) => { - if let Some(headers_other) = headers_other.as_mut() { - let from_offset = stream.pos; - let value = parse_raw(stream); - if let Some(headers_offsets) = headers_offsets.as_mut() { - headers_offsets.push(HeaderOffset { - name: HeaderOffsetName::Other(name.clone()), + let from_offset = stream.pos; + parse_and_ignore(stream); + if let Some(headers_raw) = headers_raw.as_mut() { + headers_raw + .entry(HeaderOffsetName::Other(name)) + .or_insert_with(Vec::new) + .push(HeaderOffset { start: from_offset, end: stream.pos, }); - } - - if !value.is_empty() { - match headers_other.entry(name.clone()) { - Entry::Occupied(mut e) => { - if let HeaderValue::Collection(col) = e.get_mut() { - col.push(value); - } else { - let old_value = e.remove(); - headers_other.insert( - name, - HeaderValue::Collection(vec![old_value, value]), - ); - } - } - Entry::Vacant(e) => { - e.insert(value); - } - } - } } } HeaderParserResult::Lf => return true, diff --git a/src/parsers/message.rs b/src/parsers/message.rs index 1becb06..baa2770 100644 --- a/src/parsers/message.rs +++ b/src/parsers/message.rs @@ -194,7 +194,7 @@ impl<'x> Message<'x> { /// Returns `false` if at least one header field was successfully parsed. pub fn is_empty(&self) -> bool { - self.headers_rfc.is_empty() && self.headers_other.is_empty() + self.headers_rfc.is_empty() && self.headers_raw.is_empty() } /// Parses a byte slice containing the RFC5322 raw message and returns a @@ -220,8 +220,7 @@ impl<'x> Message<'x> { message.offset_header = stream.pos; if !parse_headers( &mut message.headers_rfc, - Some(&mut message.headers_other), - Some(&mut message.headers_offsets), + Some(&mut message.headers_raw), &mut stream, ) { break; @@ -229,7 +228,7 @@ impl<'x> Message<'x> { message.offset_body = seek_crlf_end(&stream, stream.pos); (true, &mut message.headers_rfc) } else { - if !parse_headers(&mut mime_part_header, None, None, &mut stream) { + if !parse_headers(&mut mime_part_header, None, &mut stream) { break; } (false, &mut mime_part_header) @@ -644,8 +643,7 @@ mod tests { } } - /*/ - #[test] + /*#[test] fn message_to_yaml() { let mut file_name = PathBuf::from(env!("CARGO_MANIFEST_DIR")); file_name.push("tests"); diff --git a/tests/integration_test.rs b/tests/integration_test.rs index a7571b6..631bdb3 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -64,35 +64,26 @@ R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 assert_eq!( message.get_from(), - &HeaderValue::Address(Addr { - name: Some("Art Vandelay (Vandelay Industries)".into()), - address: Some("art@vandelay.com".into()) - }) + &HeaderValue::Address(Addr::new( + "Art Vandelay (Vandelay Industries)".into(), + "art@vandelay.com" + )) ); assert_eq!( message.get_to(), &HeaderValue::GroupList(vec![ - Group { - name: Some("Colleagues".into()), - addresses: vec![Addr { - name: Some("James Smythe".into()), - address: Some("james@vandelay.com".into()) - }] - }, - Group { - name: Some("Friends".into()), - addresses: vec![ - Addr { - name: None, - address: Some("jane@example.com".into()) - }, - Addr { - name: Some("John Smîth".into()), - address: Some("john@example.com".into()) - } + Group::new( + "Colleagues", + vec![Addr::new("James Smythe".into(), "james@vandelay.com")] + ), + Group::new( + "Friends", + vec![ + Addr::new(None, "jane@example.com"), + Addr::new("John Smîth".into(), "john@example.com"), ] - } + ) ]) ); diff --git a/tests/legacy/000.txt b/tests/legacy/000.txt index b4930f5..ed11040 100644 --- a/tests/legacy/000.txt +++ b/tests/legacy/000.txt @@ -45,39 +45,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, "to": { "Address": { "name": "Joe Blow", "address": "jblow@example.com" } }, - "content_transfer_encoding": { - "Text": "base64" - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, "date": { "DateTime": { "year": 2000, @@ -91,6 +64,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -99,125 +75,32 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGKEKECHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } } }, - "headers_other": { - "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)" - }, - "Importance": { - "Text": "Normal" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 291 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 317, - "end": 326 - }, - { - "name": { - "Rfc": "content_disposition" - }, - "start": 346, - "end": 385 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 396, - "end": 409 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 427, - "end": 436 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 445, - "end": 498 - }, - { - "name": { - "Other": "Importance" - }, - "start": 509, - "end": 518 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 528, - "end": 576 - } - ], "html_body": [], "text_body": [], "attachments": [ diff --git a/tests/legacy/001.txt b/tests/legacy/001.txt index 2a3808f..5a33728 100644 --- a/tests/legacy/001.txt +++ b/tests/legacy/001.txt @@ -36,9 +36,6 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, "to": { "AddressList": [ { @@ -51,11 +48,14 @@ m+APw-ssen als wir.+ACI-=20 } ] }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" }, "date": { "DateTime": { @@ -70,9 +70,6 @@ m+APw-ssen als wir.+ACI-=20 "tz_minute": 0 } }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, "content_type": { "ContentType": { "c_type": "text", @@ -82,123 +79,16 @@ m+APw-ssen als wir.+ACI-=20 } } }, - "content_transfer_encoding": { - "Text": "quoted-printable" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGMEKCCHAA.doug@example.com" + "mime_version": { + "Text": "1.0" } }, - "headers_other": { - "X-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "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": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 39 - }, - { - "name": { - "Rfc": "to" - }, - "start": 42, - "end": 146 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 154, - "end": 224 - }, - { - "name": { - "Rfc": "date" - }, - "start": 229, - "end": 262 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 273, - "end": 322 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 335, - "end": 340 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 353, - "end": 383 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 409, - "end": 427 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 438, - "end": 450 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 468, - "end": 476 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 485, - "end": 537 - }, - { - "name": { - "Other": "Importance" - }, - "start": 548, - "end": 556 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 566, - "end": 613 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/002.txt b/tests/legacy/002.txt index 9961b52..78bfce4 100644 --- a/tests/legacy/002.txt +++ b/tests/legacy/002.txt @@ -38,17 +38,11 @@ wir."
---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" + "subject": { + "Text": "Die Hasen und die Frösche" }, - "message_id": { - "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "content_transfer_encoding": { + "Text": "quoted-printable" }, "content_type": { "ContentType": { @@ -59,8 +53,14 @@ wir."
} } }, - "subject": { - "Text": "Die Hasen und die Frösche" + "message_id": { + "Text": "4.2.0.58.20000519003052.00a89c40@pop.example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } }, "to": { "Address": { @@ -68,6 +68,9 @@ wir."
"address": "mueller@example.com" } }, + "mime_version": { + "Text": "1.0" + }, "date": { "DateTime": { "year": 2000, @@ -80,101 +83,8 @@ wir."
"tz_hour": 4, "tz_minute": 0 } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "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)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 290 - }, - { - "name": { - "Rfc": "from" - }, - "start": 295, - "end": 332 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 340, - "end": 387 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 400, - "end": 406 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 419, - "end": 453 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 479, - "end": 498 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/003.txt b/tests/legacy/003.txt index b88dc0b..40a17ec 100644 --- a/tests/legacy/003.txt +++ b/tests/legacy/003.txt @@ -65,15 +65,12 @@ wir."
---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "mime_version": { "Text": "1.0" }, + "message_id": { + "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -83,17 +80,20 @@ wir."
} } }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "to": { "Address": { "name": "Heinz Müller", "address": "mueller@example.com" } }, - "message_id": { - "Text": "4.2.0.58.20000519002557.00a88870@pop.example.com" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" }, "date": { "DateTime": { @@ -109,89 +109,6 @@ wir."
} } }, - "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)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 290 - }, - { - "name": { - "Rfc": "from" - }, - "start": 295, - "end": 332 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 340, - "end": 387 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 400, - "end": 406 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 419, - "end": 496 - } - ], "html_body": [ 1 ], @@ -203,6 +120,9 @@ wir."
{ "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -211,9 +131,6 @@ wir."
"charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "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" @@ -222,9 +139,6 @@ wir."
{ "Html": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -233,6 +147,9 @@ wir."
"charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, "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 65b1769..6173989 100644 --- a/tests/legacy/004.txt +++ b/tests/legacy/004.txt @@ -20,36 +20,12 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "us-ascii" - } - } - }, "to": { "Address": { "name": "Joe Blow", "address": "blow@example.com" } }, - "subject": { - "Text": "The Hare and the Tortoise" - }, "date": { "DateTime": { "year": 2000, @@ -62,91 +38,32 @@ Slow but steady wins the race. "tz_hour": 4, "tz_minute": 0 } + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "us-ascii" + } + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "message_id": { + "Text": "4.2.0.58.20000519011207.00a8cd70@pop.example.com" + }, + "subject": { + "Text": "The Hare and the Tortoise" } }, - "headers_other": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Priority": { - "Text": "5 (Lowest)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 194 - }, - { - "name": { - "Rfc": "date" - }, - "start": 199, - "end": 233 - }, - { - "name": { - "Rfc": "to" - }, - "start": 236, - "end": 266 - }, - { - "name": { - "Rfc": "from" - }, - "start": 271, - "end": 308 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 316, - "end": 344 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 357, - "end": 363 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 376, - "end": 409 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/005.txt b/tests/legacy/005.txt index d595639..a463e8e 100644 --- a/tests/legacy/005.txt +++ b/tests/legacy/005.txt @@ -34,24 +34,27 @@ m+APw-ssen als wir.+ACI-=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "utf-7" + } + } + }, "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": "Heinz Müller", - "address": "mueller@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -65,132 +68,19 @@ m+APw-ssen als wir.+ACI-=20 "tz_minute": 0 } }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "utf-7" - } - } - }, "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGCEKDCHAA.doug@example.com" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "subject": { + "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" } }, - "headers_other": { - "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" - }, - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 96 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 104, - "end": 175 - }, - { - "name": { - "Rfc": "date" - }, - "start": 180, - "end": 214 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 225, - "end": 275 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 288, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 339 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 365, - "end": 384 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 395, - "end": 408 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 426, - "end": 435 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 444, - "end": 497 - }, - { - "name": { - "Other": "Importance" - }, - "start": 508, - "end": 517 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 527, - "end": 575 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/006.txt b/tests/legacy/006.txt index 66b306a..cbcd9e4 100644 --- a/tests/legacy/006.txt +++ b/tests/legacy/006.txt @@ -85,10 +85,10 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { + "from": { "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" + "name": "Doug Sauder", + "address": "doug@example.com" } }, "content_type": { @@ -100,21 +100,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" - }, - "from": { + "to": { "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" + "name": "Joe Blow", + "address": "jblow@example.com" } }, - "mime_version": { - "Text": "1.0" - }, "date": { "DateTime": { "year": 2000, @@ -127,111 +118,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_hour": 4, "tz_minute": 0 } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKECHAA.doug@example.com" + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "mime_version": { + "Text": "1.0" } }, - "headers_other": { - "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" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 331 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 342, - "end": 355 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 373, - "end": 382 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 391, - "end": 444 - }, - { - "name": { - "Other": "Importance" - }, - "start": 455, - "end": 464 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 474, - "end": 522 - } - ], "html_body": [], "text_body": [], "attachments": [ @@ -242,18 +139,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -262,6 +147,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } } }, "body": [ @@ -1596,9 +1493,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -1608,6 +1502,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "attachment", diff --git a/tests/legacy/007.txt b/tests/legacy/007.txt index 4d936ed..ea9bd75 100644 --- a/tests/legacy/007.txt +++ b/tests/legacy/007.txt @@ -33,30 +33,9 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, "subject": { "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" }, - "mime_version": { - "Text": "1.0" - }, "date": { "DateTime": { "year": 2000, @@ -70,6 +49,18 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "tz_minute": 0 } }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "to": { "Address": { "name": "Jürgen Schmürgen", @@ -78,118 +69,17 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 }, "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGIEKCCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "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)" - }, - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 112 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 120, - "end": 194 - }, - { - "name": { - "Rfc": "date" - }, - "start": 199, - "end": 233 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 244, - "end": 294 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 307, - "end": 313 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 326, - "end": 363 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 389, - "end": 408 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 419, - "end": 432 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 450, - "end": 459 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 468, - "end": 521 - }, - { - "name": { - "Other": "Importance" - }, - "start": 532, - "end": 541 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 551, - "end": 599 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/008.txt b/tests/legacy/008.txt index b5189cb..1455cf3 100644 --- a/tests/legacy/008.txt +++ b/tests/legacy/008.txt @@ -137,8 +137,11 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } }, "date": { "DateTime": { @@ -153,8 +156,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" + "subject": { + "Text": "Test message from Microsoft Outlook 00" }, "content_type": { "ContentType": { @@ -165,125 +168,19 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "mime_version": { + "Text": "1.0" + }, "to": { "Address": { "name": "Heinz Müller", "address": "mueller@example.com" } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGGEKECHAA.doug@example.com" } }, - "headers_other": { - "X-Priority": { - "Text": "3 (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-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "Text": "Normal" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 99 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 107, - "end": 148 - }, - { - "name": { - "Rfc": "date" - }, - "start": 153, - "end": 187 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 198, - "end": 248 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 261, - "end": 267 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 280, - "end": 354 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 365, - "end": 378 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 396, - "end": 405 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 414, - "end": 467 - }, - { - "name": { - "Other": "Importance" - }, - "start": 478, - "end": 487 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 497, - "end": 545 - } - ], "html_body": [ 0 ], @@ -318,15 +215,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, "content_type": { "ContentType": { "c_type": "image", @@ -336,6 +224,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" } @@ -2999,6 +2896,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" }, @@ -3010,15 +2916,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } } }, "body": [ diff --git a/tests/legacy/009.txt b/tests/legacy/009.txt index a06f6cd..b5167f4 100644 --- a/tests/legacy/009.txt +++ b/tests/legacy/009.txt @@ -38,12 +38,6 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "4.2.0.58.20000519010441.00a8d140@pop.example.com" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "date": { "DateTime": { "year": 2000, @@ -57,135 +51,41 @@ 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" + }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "mime_version": { "Text": "1.0" }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "format": "flowed", - "charset": "iso-8859-1" - } - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "to": { "Address": { "name": "Jürgen Schmürgen", "address": "jschmuergen@example.com" } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1", + "format": "flowed" + } + } } }, - "headers_other": { - "X-Priority": { - "Text": "1 (Highest)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "Disposition-Notification-To": { - "Text": "" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "Disposition-Notification-To" - }, - "start": 141, - "end": 166 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 175, - "end": 223 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 234, - "end": 248 - }, - { - "name": { - "Rfc": "date" - }, - "start": 253, - "end": 287 - }, - { - "name": { - "Rfc": "to" - }, - "start": 290, - "end": 373 - }, - { - "name": { - "Rfc": "from" - }, - "start": 378, - "end": 415 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 423, - "end": 468 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 481, - "end": 487 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 500, - "end": 550 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 576, - "end": 595 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/010.txt b/tests/legacy/010.txt index 4764c45..138d2d4 100644 --- a/tests/legacy/010.txt +++ b/tests/legacy/010.txt @@ -23,15 +23,36 @@ In einem nahen Teich wollten sie sich nun ers ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "subject": { + "Text": "Die Hasen und die Fr�sche" + }, + "message_id": { + "Text": "4.2.0.58.20000519010842.00a8c7f0@pop.example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } + }, + "content_transfer_encoding": { + "Text": "8bit" + }, "to": { "Address": { "name": "Heinz M�ller", "address": "mueller@example.com" } }, - "mime_version": { - "Text": "1.0" - }, "date": { "DateTime": { "year": 2000, @@ -45,121 +66,10 @@ In einem nahen Teich wollten sie sich nun ers "tz_minute": 0 } }, - "subject": { - "Text": "Die Hasen und die Fr�sche" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "content_transfer_encoding": { - "Text": "8bit" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "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" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 195 - }, - { - "name": { - "Rfc": "date" - }, - "start": 200, - "end": 234 - }, - { - "name": { - "Rfc": "to" - }, - "start": 237, - "end": 274 - }, - { - "name": { - "Rfc": "from" - }, - "start": 279, - "end": 316 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 324, - "end": 352 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 365, - "end": 371 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 384, - "end": 419 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 445, - "end": 452 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/011.txt b/tests/legacy/011.txt index c64c9cf..bcb1a44 100644 --- a/tests/legacy/011.txt +++ b/tests/legacy/011.txt @@ -31,6 +31,36 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "message_id": { + "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } + }, "date": { "DateTime": { "year": 2000, @@ -44,120 +74,10 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "tz_minute": 0 } }, - "message_id": { - "Text": "4.2.0.58.20000519001217.00a85b60@pop.example.com" - }, "content_transfer_encoding": { "Text": "quoted-printable" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } } }, - "headers_other": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 299 - }, - { - "name": { - "Rfc": "from" - }, - "start": 304, - "end": 341 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 349, - "end": 396 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 409, - "end": 415 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 428, - "end": 463 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 489, - "end": 508 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/012.txt b/tests/legacy/012.txt index 4b66e14..5e90eeb 100644 --- a/tests/legacy/012.txt +++ b/tests/legacy/012.txt @@ -32,39 +32,6 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "mime_version": { - "Text": "1.0" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "Windows-1252" - } - } - }, "date": { "DateTime": { "year": 2000, @@ -77,118 +44,41 @@ Tiere, welche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "tz_hour": 4, "tz_minute": 0 } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "Windows-1252" + } + } + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@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" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKECHAA.doug@example.com" } }, - "headers_other": { - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (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": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 101 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 109, - "end": 185 - }, - { - "name": { - "Rfc": "date" - }, - "start": 190, - "end": 224 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 235, - "end": 285 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 298, - "end": 304 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 317, - "end": 356 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 382, - "end": 401 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 412, - "end": 425 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 443, - "end": 452 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 461, - "end": 514 - }, - { - "name": { - "Other": "Importance" - }, - "start": 525, - "end": 534 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 544, - "end": 592 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/013.txt b/tests/legacy/013.txt index ef52e78..019c720 100644 --- a/tests/legacy/013.txt +++ b/tests/legacy/013.txt @@ -36,6 +36,36 @@ welche also wohl noch ungl "subject": { "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" + }, "date": { "DateTime": { "year": 2000, @@ -48,148 +78,8 @@ welche also wohl noch ungl "tz_hour": 4, "tz_minute": 0 } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGEEKCCHAA.doug@example.com" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } - }, - "content_transfer_encoding": { - "Text": "8bit" } }, - "headers_other": { - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "Importance": { - "Text": "Normal" - }, - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 112 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 120, - "end": 194 - }, - { - "name": { - "Rfc": "date" - }, - "start": 199, - "end": 233 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 244, - "end": 294 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 307, - "end": 313 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 326, - "end": 363 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 389, - "end": 396 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 407, - "end": 420 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 438, - "end": 447 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 456, - "end": 509 - }, - { - "name": { - "Other": "Importance" - }, - "start": 520, - "end": 529 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 539, - "end": 587 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/014.txt b/tests/legacy/014.txt index dbe7f14..5f8102a 100644 --- a/tests/legacy/014.txt +++ b/tests/legacy/014.txt @@ -74,6 +74,30 @@ race. =20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "alternative", + "attributes": { + "boundary": "----=_NextPart_000_0005_01BFC037.799BEF60" + } + } + }, + "mime_version": { + "Text": "1.0" + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "jblow@example.com" + } + }, "date": { "DateTime": { "year": 2000, @@ -87,140 +111,13 @@ race. =20 "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, - "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" - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGCEKFCHAA.doug@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "alternative", - "attributes": { - "boundary": "----=_NextPart_000_0005_01BFC037.799BEF60" - } - } } }, - "headers_other": { - "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-MSMail-Priority": { - "Text": "Normal" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 337 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 348, - "end": 361 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 379, - "end": 388 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 397, - "end": 450 - }, - { - "name": { - "Other": "Importance" - }, - "start": 461, - "end": 470 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 480, - "end": 528 - } - ], "html_body": [ 1 ], @@ -251,6 +148,9 @@ race. =20 { "Html": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -259,9 +159,6 @@ race. =20 "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "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 604e9ed..8a8032b 100644 --- a/tests/legacy/015.txt +++ b/tests/legacy/015.txt @@ -200,15 +200,30 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "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==_" + } + } + }, + "message_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, "to": { "Address": { "name": "Heinz Müller", @@ -227,106 +242,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "mime_version": { - "Text": "1.0" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_715392540==_" - } - } } }, - "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)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 482 - } - ], "html_body": [ 3 ], @@ -347,8 +264,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715392540==_.REL", - "type": "multipart/alternative" + "type": "multipart/alternative", + "boundary": "=====================_715392540==_.REL" } } } @@ -389,6 +306,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Html": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -397,9 +317,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "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" @@ -1765,8 +1682,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_id": { - "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" + "content_transfer_encoding": { + "Text": "base64" }, "content_type": { "ContentType": { @@ -1777,9 +1694,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1788,6 +1702,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "2aa3edd1.png" } } + }, + "content_id": { + "Text": "4.2.0.58.20000519003556.00a918e0@pop.example.com.3" } }, "body": [ @@ -3253,15 +3170,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "content_transfer_encoding": { "Text": "base64" }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -3270,6 +3178,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "blueball.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } } }, "body": [ @@ -4604,9 +4521,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -4624,6 +4538,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, "body": [ diff --git a/tests/legacy/016.txt b/tests/legacy/016.txt index 4b251bd..2e510a5 100644 --- a/tests/legacy/016.txt +++ b/tests/legacy/016.txt @@ -97,12 +97,36 @@ JB@ac)(GTFLiL)!d09'8!!!: ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "jschmuergen@example.com" + } + }, + "message_id": { + "Text": "4.2.0.58.20000519005150.00a85230@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": "=====================_716373961==_" + } + } + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, "date": { "DateTime": { "year": 2000, @@ -115,105 +139,8 @@ JB@ac)(GTFLiL)!d09'8!!!: "tz_hour": 4, "tz_minute": 0 } - }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "=====================_716373961==_" - } - } - }, - "message_id": { - "Text": "4.2.0.58.20000519005150.00a85230@pop.example.com" - }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "jschmuergen@example.com" - } - }, - "mime_version": { - "Text": "1.0" } }, - "headers_other": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 295 - }, - { - "name": { - "Rfc": "from" - }, - "start": 300, - "end": 337 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 345, - "end": 390 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 403, - "end": 409 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 422, - "end": 489 - } - ], "html_body": [ 0 ], @@ -228,9 +155,6 @@ JB@ac)(GTFLiL)!d09'8!!!: { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -239,6 +163,9 @@ JB@ac)(GTFLiL)!d09'8!!!: "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, "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/017.txt b/tests/legacy/017.txt index 8b3fc91..926841d 100644 --- a/tests/legacy/017.txt +++ b/tests/legacy/017.txt @@ -107,18 +107,6 @@ end "message_id": { "Text": "4.2.0.58.20000519004755.00a86100@pop.example.com" }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "jschmuergen@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -135,9 +123,21 @@ end "subject": { "Text": "The Hare and the Tortoise" }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, "mime_version": { "Text": "1.0" }, + "to": { + "Address": { + "name": "J�rgen Schm�rgen", + "address": "jschmuergen@example.com" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -148,79 +148,6 @@ end } } }, - "headers_other": { - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 257 - }, - { - "name": { - "Rfc": "from" - }, - "start": 262, - "end": 299 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 307, - "end": 335 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 348, - "end": 354 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 367, - "end": 434 - } - ], "html_body": [ 0 ], @@ -260,9 +187,6 @@ end } } }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_type": { "ContentType": { "c_type": "image", @@ -271,6 +195,9 @@ end "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "x-uuencode" } }, "body": [ @@ -2135,15 +2062,6 @@ end { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, "content_transfer_encoding": { "Text": "x-uuencode" }, @@ -2155,6 +2073,15 @@ end "filename": "blueball.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } } }, "body": [ diff --git a/tests/legacy/018.txt b/tests/legacy/018.txt index 3cab616..f452851 100644 --- a/tests/legacy/018.txt +++ b/tests/legacy/018.txt @@ -140,16 +140,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "related", - "attributes": { - "type": "multipart/alternative", - "boundary": "=====================_715157131==_.REL" - } + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, + "message_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" + }, "subject": { "Text": "Die Hasen und die Frösche" }, @@ -159,16 +158,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "address": "mueller@example.com" } }, - "message_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com" - }, "mime_version": { "Text": "1.0" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "related", + "attributes": { + "type": "multipart/alternative", + "boundary": "=====================_715157131==_.REL" + } } }, "date": { @@ -185,89 +185,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "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" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 520 - } - ], "html_body": [ 2 ], @@ -295,9 +212,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -306,6 +220,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, "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" @@ -314,9 +231,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Html": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -325,6 +239,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, "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" @@ -333,18 +250,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "blueball.png" - } - } - }, - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" - }, "content_type": { "ContentType": { "c_type": "image", @@ -356,6 +261,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== }, "content_transfer_encoding": { "Text": "base64" + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "blueball.png" + } + } + }, + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.0" } }, "body": [ @@ -1690,9 +1607,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_id": { - "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1702,6 +1616,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -1711,8 +1628,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_id": { + "Text": "4.2.0.58.20000519003143.00a8d550@pop.example.com.1" } }, "body": [ diff --git a/tests/legacy/019.txt b/tests/legacy/019.txt index b1210d4..549baad 100644 --- a/tests/legacy/019.txt +++ b/tests/legacy/019.txt @@ -146,11 +146,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGGEKFCHAA.doug@example.com" - }, - "mime_version": { - "Text": "1.0" + "subject": { + "Text": "Test message from Microsoft Outlook 00" }, "content_type": { "ContentType": { @@ -161,15 +158,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" - } - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" - }, "date": { "DateTime": { "year": 2000, @@ -183,116 +171,25 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, + "mime_version": { + "Text": "1.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" } }, - "headers_other": { - "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)" - }, - "Importance": { - "Text": "Normal" - }, - "X-MSMail-Priority": { - "Text": "Normal" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 331 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 342, - "end": 355 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 373, - "end": 382 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 391, - "end": 444 - }, - { - "name": { - "Other": "Importance" - }, - "start": 455, - "end": 464 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 474, - "end": 522 - } - ], "html_body": [ 2 ], @@ -320,6 +217,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -328,9 +228,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "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" @@ -358,6 +255,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "greenball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" }, @@ -369,15 +275,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "greenball.png" } } - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "greenball.png" - } - } } }, "body": [ @@ -1688,15 +1585,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "content_transfer_encoding": { "Text": "base64" }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "redball.png" - } - } - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1705,6 +1593,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "redball.png" + } + } } }, "body": [ diff --git a/tests/legacy/020.txt b/tests/legacy/020.txt index a59229d..561f251 100644 --- a/tests/legacy/020.txt +++ b/tests/legacy/020.txt @@ -33,30 +33,6 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } - }, - "content_transfer_encoding": { - "Text": "8bit" - }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, - "to": { - "Address": { - "name": "J�rgen Schm�rgen", - "address": "schmuergen@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -70,126 +46,40 @@ welche also wohl noch ungl "tz_minute": 0 } }, + "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" + } + }, "message_id": { "Text": "NDBBIAKOPKHFGPLCODIGIEKBCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_transfer_encoding": { + "Text": "8bit" + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } } }, - "headers_other": { - "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-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 89 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 97, - "end": 148 - }, - { - "name": { - "Rfc": "date" - }, - "start": 153, - "end": 187 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 198, - "end": 248 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 261, - "end": 267 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 280, - "end": 317 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 343, - "end": 350 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 361, - "end": 374 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 392, - "end": 401 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 410, - "end": 463 - }, - { - "name": { - "Other": "Importance" - }, - "start": 474, - "end": 483 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 493, - "end": 541 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/021.txt b/tests/legacy/021.txt index 11f8995..8e8f310 100644 --- a/tests/legacy/021.txt +++ b/tests/legacy/021.txt @@ -196,9 +196,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "address": "jblow@example.com" } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" - }, "date": { "DateTime": { "year": 2000, @@ -212,11 +209,14 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } + "subject": { + "Text": "Test message from Microsoft Outlook 00" + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKFCHAA.doug@example.com" + }, + "mime_version": { + "Text": "1.0" }, "content_type": { "ContentType": { @@ -227,116 +227,13 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } } }, - "headers_other": { - "X-MSMail-Priority": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "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" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 238, - "end": 244 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 257, - "end": 331 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 342, - "end": 355 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 373, - "end": 382 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 391, - "end": 444 - }, - { - "name": { - "Other": "Importance" - }, - "start": 455, - "end": 464 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 474, - "end": 522 - } - ], "html_body": [ 3 ], @@ -419,9 +316,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "content_id": { "Text": "938014623@17052000-0f9b" }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -430,6 +324,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, "body": [ @@ -1764,9 +1661,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1784,6 +1678,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, "body": [ @@ -3100,6 +2997,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -3108,9 +3008,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "filename": "redball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, "body": [ diff --git a/tests/legacy/022.txt b/tests/legacy/022.txt index 1b44e91..7310933 100644 --- a/tests/legacy/022.txt +++ b/tests/legacy/022.txt @@ -32,11 +32,8 @@ IiANCg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "content_transfer_encoding": { - "Text": "base64" - }, - "mime_version": { - "Text": "1.0" + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" }, "content_type": { "ContentType": { @@ -47,9 +44,6 @@ IiANCg== } } }, - "subject": { - "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" - }, "to": { "Address": { "name": "J�rgen Schm�rgen", @@ -62,8 +56,14 @@ IiANCg== "address": "doug@example.com" } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGAEKCCHAA.doug@example.com" + "subject": { + "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "mime_version": { + "Text": "1.0" }, "date": { "DateTime": { @@ -79,116 +79,6 @@ IiANCg== } } }, - "headers_other": { - "X-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" - }, - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - }, - "X-Mailer": { - "Text": "Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 89 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 97, - "end": 148 - }, - { - "name": { - "Rfc": "date" - }, - "start": 153, - "end": 187 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 198, - "end": 248 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 261, - "end": 267 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 280, - "end": 317 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 343, - "end": 352 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 363, - "end": 376 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 394, - "end": 403 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 412, - "end": 465 - }, - { - "name": { - "Other": "Importance" - }, - "start": 476, - "end": 485 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 495, - "end": 543 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/023.txt b/tests/legacy/023.txt index b1a419c..058e8d0 100644 --- a/tests/legacy/023.txt +++ b/tests/legacy/023.txt @@ -110,27 +110,9 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "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" - } - }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -140,6 +122,12 @@ 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" + } + }, "date": { "DateTime": { "year": 2000, @@ -152,81 +140,20 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "tz_hour": 4, "tz_minute": 0 } + }, + "message_id": { + "Text": "4.2.0.58.20000519005505.00a853a0@pop.example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "mime_version": { + "Text": "1.0" } }, - "headers_other": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 295 - }, - { - "name": { - "Rfc": "from" - }, - "start": 300, - "end": 337 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 345, - "end": 390 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 403, - "end": 409 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 422, - "end": 489 - } - ], "html_body": [ 0 ], @@ -242,9 +169,6 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -253,6 +177,9 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "charset": "iso-8859-1" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, "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" @@ -261,9 +188,6 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -281,6 +205,9 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= "filename": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, "body": [ @@ -1640,6 +1567,15 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= { "Text": { "headers": { + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "charset": "iso-8859-1" + } + } + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -1651,15 +1587,6 @@ In einem nahen Teich wollten sie sich nun ers=E4ufen; sie eilten ihm zu;= }, "content_transfer_encoding": { "Text": "quoted-printable" - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "charset": "iso-8859-1" - } - } } }, "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 d377d9b..80e196e 100644 --- a/tests/legacy/024.txt +++ b/tests/legacy/024.txt @@ -111,6 +111,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -121,17 +133,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "message_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com" }, "date": { "DateTime": { @@ -146,99 +149,13 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, "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)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 508 - } - ], "html_body": [ 0 ], @@ -253,6 +170,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Html": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -261,9 +181,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "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" @@ -272,12 +189,18 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" - }, "content_transfer_encoding": { "Text": "base64" }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa48eb6.png" + } + } + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -287,14 +210,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa48eb6.png" - } - } + "content_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.2" } }, "body": [ @@ -1629,21 +1546,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "filename": "2aa48ec0.png" - } - } + "content_id": { + "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" }, "content_transfer_encoding": { "Text": "base64" }, - "content_id": { - "Text": "4.2.0.58.20000519003735.00a8d7e0@pop.example.com.3" - }, "content_type": { "ContentType": { "c_type": "image", @@ -1652,6 +1560,15 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "2aa48ec0.png" } } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "filename": "2aa48ec0.png" + } + } } }, "body": [ diff --git a/tests/legacy/025.txt b/tests/legacy/025.txt index 6d8192c..2c62b63 100644 --- a/tests/legacy/025.txt +++ b/tests/legacy/025.txt @@ -173,19 +173,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 38, - "second": 13, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" } }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -195,9 +191,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "mime_version": { "Text": "1.0" }, @@ -210,96 +203,20 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "message_id": { "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 38, + "second": 13, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 } } }, - "headers_other": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - }, - "X-Priority": { - "Text": "2 (High)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 482 - } - ], "html_body": [ 1 ], @@ -320,8 +237,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "multipart", "c_subtype": "related", "attributes": { - "type": "text/html", - "boundary": "=====================_715462801==_.REL" + "boundary": "=====================_715462801==_.REL", + "type": "text/html" } } } @@ -349,6 +266,12 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, + "content_id": { + "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -358,12 +281,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, - "content_id": { - "Text": "4.2.0.58.20000519003809.00a85140@pop.example.com.2" - }, "content_type": { "ContentType": { "c_type": "image", @@ -3191,6 +3108,9 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -3200,9 +3120,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -4545,15 +4462,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -4565,6 +4473,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_transfer_encoding": { "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } + } } }, "body": [ diff --git a/tests/legacy/026.txt b/tests/legacy/026.txt index 4655d80..d24b3fa 100644 --- a/tests/legacy/026.txt +++ b/tests/legacy/026.txt @@ -86,6 +86,27 @@ Birds of a feather flock together. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "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" + }, + "to": { + "Address": { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -95,12 +116,6 @@ Birds of a feather flock together. } } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -113,96 +128,8 @@ Birds of a feather flock together. "tz_hour": 4, "tz_minute": 0 } - }, - "mime_version": { - "Text": "1.0" - }, - "message_id": { - "Text": "4.2.0.58.20000519005818.00a86aa0@pop.example.com" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, - "headers_other": { - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Rfc": "date" - }, - "start": 175, - "end": 209 - }, - { - "name": { - "Rfc": "to" - }, - "start": 212, - "end": 266 - }, - { - "name": { - "Rfc": "from" - }, - "start": 271, - "end": 308 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 316, - "end": 361 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 374, - "end": 380 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 393, - "end": 460 - } - ], "html_body": [ 0 ], @@ -217,6 +144,9 @@ Birds of a feather flock together. { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -225,9 +155,6 @@ Birds of a feather flock together. "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "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" @@ -239,6 +166,17 @@ Birds of a feather flock together. "content_transfer_encoding": { "Text": "x-uuencode" }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": { + "x-mac-creator": "74747874", + "x-mac-type": "54455854", + "name": "HasenundFr�sche.txt" + } + } + }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -247,17 +185,6 @@ Birds of a feather flock together. "filename": "HasenundFr�sche.txt" } } - }, - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": { - "x-mac-type": "54455854", - "name": "HasenundFr�sche.txt", - "x-mac-creator": "74747874" - } - } } }, "body": "\r\nbegin 600 HasenundFr�sche.txt\r\nM1&EE($AA\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" @@ -330,9 +257,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_type": { "ContentType": { "c_type": "image", @@ -341,6 +265,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, "body": [ diff --git a/tests/legacy/033.txt b/tests/legacy/033.txt index e618c4a..33de672 100644 --- a/tests/legacy/033.txt +++ b/tests/legacy/033.txt @@ -35,37 +35,12 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "to": { "Address": { "name": "Joe Blow", "address": "blow@example.com" } }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 30, - "second": 41, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "message_id": { - "Text": "392363E1.2AC47AB3@example.com" - }, "from": { "Address": { "name": "Doug Sauder", @@ -80,98 +55,33 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "charset": "UTF-8" } } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 30, + "second": 41, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "message_id": { + "Text": "392363E1.2AC47AB3@example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - }, - "X-Priority": { - "Text": "5 (Lowest)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 305, - "end": 318 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 331, - "end": 359 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 385, - "end": 404 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/034.txt b/tests/legacy/034.txt index d5659fe..a0e2a9f 100644 --- a/tests/legacy/034.txt +++ b/tests/legacy/034.txt @@ -28,37 +28,9 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 33, - "second": 43, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Fr+APY-sche" - }, "mime_version": { "Text": "1.0" }, - "content_transfer_encoding": { - "Text": "7bit" - }, - "message_id": { - "Text": "39236497.12FA2A89@example.com" - }, - "to": { - "Address": { - "name": "Heinz M+APw-ller", - "address": "mueller@example.com" - } - }, "from": { "Address": { "name": "Doug Sauder", @@ -73,88 +45,36 @@ welche also wohl noch ungl+uKs-licher sein m+vLM-en als wir." "charset": "UTF-7" } } + }, + "subject": { + "Text": "Die Hasen und die Fr+APY-sche" + }, + "to": { + "Address": { + "name": "Heinz M+APw-ller", + "address": "mueller@example.com" + } + }, + "content_transfer_encoding": { + "Text": "7bit" + }, + "message_id": { + "Text": "39236497.12FA2A89@example.com" + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 33, + "second": 43, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 253 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 261, - "end": 293 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 306, - "end": 334 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 360, - "end": 367 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/035.txt b/tests/legacy/035.txt index 63cf16c..0f5454b 100644 --- a/tests/legacy/035.txt +++ b/tests/legacy/035.txt @@ -214,6 +214,21 @@ YII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "39235FC5.276CCE00@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -223,18 +238,6 @@ YII= } } }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Messenger 4.7)" - }, "date": { "DateTime": { "year": 2000, @@ -253,84 +256,8 @@ YII= "name": "Heinz Müller", "address": "mueller@example.com" } - }, - "message_id": { - "Text": "39235FC5.276CCE00@example.com" } }, - "headers_other": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 266 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 274, - "end": 346 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 359, - "end": 428 - } - ], "html_body": [ 3, 6, @@ -396,9 +323,6 @@ YII= { "Html": { "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -407,6 +331,9 @@ YII= "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, "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" @@ -418,9 +345,6 @@ YII= "content_transfer_encoding": { "Text": "base64" }, - "content_id": { - "Text": "part1.39235FC5.E71D8178@example.com" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -436,6 +360,9 @@ YII= "c_subtype": "png", "attributes": null } + }, + "content_id": { + "Text": "part1.39235FC5.E71D8178@example.com" } }, "body": [ @@ -1770,9 +1697,6 @@ YII= { "Binary": { "headers": { - "content_id": { - "Text": "part2.39235FC5.E71D8178@example.com" - }, "content_type": { "ContentType": { "c_type": "image", @@ -1791,6 +1715,9 @@ YII= }, "content_transfer_encoding": { "Text": "base64" + }, + "content_id": { + "Text": "part2.39235FC5.E71D8178@example.com" } }, "body": [ diff --git a/tests/legacy/036.txt b/tests/legacy/036.txt index f12df0c..c7cdbca 100644 --- a/tests/legacy/036.txt +++ b/tests/legacy/036.txt @@ -28,8 +28,18 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 10, + "minute": 18, + "second": 3, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } }, "to": { "Address": { @@ -52,88 +62,19 @@ lche also wohl noch ungl=FCcklicher sein m=FCssen als wir."=20 "address": "doug@penguin.example.com" } }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 10, - "minute": 18, - "second": 3, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" + "message_id": { + "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com" }, "content_transfer_encoding": { "Text": "QUOTED-PRINTABLE" }, - "message_id": { - "Text": "Pine.LNX.4.21.0005191014500.8452-100000@penguin.example.com" + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Die Hasen und die Frösche" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "date" - }, - "start": 5, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 91 - }, - { - "name": { - "Rfc": "to" - }, - "start": 94, - "end": 159 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 167, - "end": 214 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 225, - "end": 289 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 302, - "end": 308 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 321, - "end": 354 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 380, - "end": 399 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/037.txt b/tests/legacy/037.txt index 87e2d6f..eac4d08 100644 --- a/tests/legacy/037.txt +++ b/tests/legacy/037.txt @@ -53,12 +53,27 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------E7889DDF0F75D34163841C59" + } + } + }, + "message_id": { + "Text": "392366A7.21929EA7@example.com" + }, "to": { "Address": { "name": "Joe Blow", "address": "blow@example.com" } }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, "date": { "DateTime": { "year": 2000, @@ -72,104 +87,16 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_minute": 0 } }, + "mime_version": { + "Text": "1.0" + }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@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": "------------E7889DDF0F75D34163841C59" - } - } - }, - "message_id": { - "Text": "392366A7.21929EA7@example.com" } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 - } - ], "html_body": [ 0, 1 @@ -213,6 +140,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -221,9 +151,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "blueball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, "body": [ diff --git a/tests/legacy/038.txt b/tests/legacy/038.txt index 4380fd2..a0c602c 100644 --- a/tests/legacy/038.txt +++ b/tests/legacy/038.txt @@ -19,21 +19,8 @@ Slow but steady wins the race. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 23, - "minute": 24, - "second": 11, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, - "content_transfer_encoding": { - "Text": "7bit" + "mime_version": { + "Text": "1.0" }, "to": { "Address": { @@ -50,11 +37,18 @@ Slow but steady wins the race. } } }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "mime_version": { - "Text": "1.0" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 23, + "minute": 24, + "second": 11, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } }, "from": { "Address": { @@ -62,90 +56,16 @@ Slow but steady wins the race. "address": "dwsauder@example.com" } }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_transfer_encoding": { + "Text": "7bit" + }, "message_id": { "Text": "3923625B.59F0C3AC@example.com" } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 338 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 364, - "end": 371 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/039.txt b/tests/legacy/039.txt index b162958..5c40a47 100644 --- a/tests/legacy/039.txt +++ b/tests/legacy/039.txt @@ -173,30 +173,18 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "39236103.FFE674FC@example.com" + }, "mime_version": { "Text": "1.0" }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------B7133A01A6B323BF00DBC9A7" - } - } - }, - "message_id": { - "Text": "39236103.FFE674FC@example.com" - }, "to": { "Address": { "name": "Jürgen Schmürgen", @@ -215,81 +203,20 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------B7133A01A6B323BF00DBC9A7" + } + } } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 277 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 285, - "end": 331 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 344, - "end": 413 - } - ], "html_body": [ 1, 4, @@ -1697,12 +1624,12 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_id": { - "Text": "part2.39236103.1B697A54@example.com" - }, "content_transfer_encoding": { "Text": "base64" }, + "content_id": { + "Text": "part2.39236103.1B697A54@example.com" + }, "content_type": { "ContentType": { "c_type": "image", @@ -3180,6 +3107,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "InlineBinary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_type": { "ContentType": { "c_type": "image", @@ -3197,9 +3127,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "greenball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, "body": [ @@ -4507,6 +4434,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "InlineBinary": { "headers": { + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -4518,15 +4454,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_transfer_encoding": { "Text": "base64" - }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } } }, "body": [ diff --git a/tests/legacy/040.txt b/tests/legacy/040.txt index 405027c..a919e1e 100644 --- a/tests/legacy/040.txt +++ b/tests/legacy/040.txt @@ -30,21 +30,21 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "39236653.CAA8A090@example.com" - }, "mime_version": { "Text": "1.0" }, - "subject": { - "Text": "Die Hasen und die Frösche" - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, + "message_id": { + "Text": "39236653.CAA8A090@example.com" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "date": { "DateTime": { "year": 2000, @@ -58,6 +58,9 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "tz_minute": 0 } }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, "to": { "Address": { "name": "Jürgen Schmürgen", @@ -72,91 +75,8 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "charset": "iso-8859-1" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 277 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 285, - "end": 332 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 345, - "end": 378 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 404, - "end": 423 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/041.txt b/tests/legacy/041.txt index 6a6e769..805ea31 100644 --- a/tests/legacy/041.txt +++ b/tests/legacy/041.txt @@ -72,27 +72,15 @@ vAAAAABJRU5ErkJggg== "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, - "subject": { - "Text": "PNG graphic" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "-1463757054-170444605-958746196=:8452" - } - } - }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@penguin.example.com" } }, + "subject": { + "Text": "PNG graphic" + }, "to": { "Address": { "name": "Heinz Müller", @@ -101,60 +89,20 @@ vAAAAABJRU5ErkJggg== }, "message_id": { "Text": "Pine.LNX.4.21.0005191019440.8452-101000@penguin.example.com" + }, + "mime_version": { + "Text": "1.0" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "-1463757054-170444605-958746196=:8452" + } + } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "date" - }, - "start": 5, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 91 - }, - { - "name": { - "Rfc": "to" - }, - "start": 94, - "end": 150 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 158, - "end": 172 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 183, - "end": 247 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 260, - "end": 266 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 279, - "end": 347 - } - ], "html_body": [ 0 ], @@ -193,8 +141,8 @@ vAAAAABJRU5ErkJggg== } } }, - "content_id": { - "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com" + "content_transfer_encoding": { + "Text": "BASE64" }, "content_type": { "ContentType": { @@ -205,11 +153,11 @@ vAAAAABJRU5ErkJggg== } } }, - "content_transfer_encoding": { - "Text": "BASE64" - }, "content_description": { "Text": "red ball" + }, + "content_id": { + "Text": "Pine.LNX.4.21.0005191023160.8452@penguin.example.com" } }, "body": [ diff --git a/tests/legacy/042.txt b/tests/legacy/042.txt index 1041911..5f26f7d 100644 --- a/tests/legacy/042.txt +++ b/tests/legacy/042.txt @@ -60,27 +60,6 @@ Birds of a feather flock together. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "3923686C.99FB5E36@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": "------------77060D866A66DC8D0921E051" - } - } - }, "date": { "DateTime": { "year": 2000, @@ -94,89 +73,37 @@ Birds of a feather flock together. "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@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" + }, + "message_id": { + "Text": "3923686C.99FB5E36@example.com" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------77060D866A66DC8D0921E051" + } + } } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 - } - ], "html_body": [ 0 ], @@ -190,6 +117,9 @@ Birds of a feather flock together. { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -198,9 +128,6 @@ Birds of a feather flock together. "charset": "us-ascii" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, "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" @@ -209,25 +136,25 @@ Birds of a feather flock together. { "Text": { "headers": { - "content_disposition": { + "content_type": { "ContentType": { - "c_type": "inline", - "c_subtype": null, + "c_type": "text", + "c_subtype": "plain", "attributes": { - "filename": "farmerandstork.txt" + "charset": "us-ascii", + "name": "farmerandstork.txt" } } }, "content_transfer_encoding": { "Text": "7bit" }, - "content_type": { + "content_disposition": { "ContentType": { - "c_type": "text", - "c_subtype": "plain", + "c_type": "inline", + "c_subtype": null, "attributes": { - "name": "farmerandstork.txt", - "charset": "us-ascii" + "filename": "farmerandstork.txt" } } } diff --git a/tests/legacy/043.txt b/tests/legacy/043.txt index 43bcc9d..d36dea5 100644 --- a/tests/legacy/043.txt +++ b/tests/legacy/043.txt @@ -63,11 +63,14 @@ als wir." ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" + "mime_version": { + "Text": "1.0" }, - "message_id": { - "Text": "392359CF.DFF4527@example.com" + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } }, "to": { "Address": { @@ -75,6 +78,9 @@ als wir." "address": "mueller@example.com" } }, + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -97,89 +103,10 @@ als wir." "tz_minute": 0 } }, - "mime_version": { - "Text": "1.0" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } + "message_id": { + "Text": "392359CF.DFF4527@example.com" } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 44 - }, - { - "name": { - "Rfc": "date" - }, - "start": 49, - "end": 83 - }, - { - "name": { - "Rfc": "from" - }, - "start": 88, - "end": 125 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 134, - "end": 164 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 182, - "end": 187 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 200, - "end": 206 - }, - { - "name": { - "Rfc": "to" - }, - "start": 209, - "end": 265 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 273, - "end": 348 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 361, - "end": 436 - } - ], "html_body": [ 1 ], diff --git a/tests/legacy/044.txt b/tests/legacy/044.txt index 0304604..fec00d9 100644 --- a/tests/legacy/044.txt +++ b/tests/legacy/044.txt @@ -139,36 +139,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Joe Blow", - "address": "blow@example.com" - } - }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, - "message_id": { - "Text": "39235E1C.1DC7EA90@example.com" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------A1FCDEE154E03D875E5D6779" - } - } - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "date": { "DateTime": { "year": 2000, @@ -181,81 +151,38 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "tz_hour": 4, "tz_minute": 0 } + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "------------A1FCDEE154E03D875E5D6779" + } + } + }, + "to": { + "Address": { + "name": "Joe Blow", + "address": "blow@example.com" + } + }, + "mime_version": { + "Text": "1.0" + }, + "subject": { + "Text": "Test message from Netscape Communicator 4.7" + }, + "message_id": { + "Text": "39235E1C.1DC7EA90@example.com" + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } } }, - "headers_other": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 - } - ], "html_body": [ 0, 1, @@ -296,6 +223,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "InlineBinary": { "headers": { + "content_transfer_encoding": { + "Text": "base64" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -313,9 +243,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "redball.png" } } - }, - "content_transfer_encoding": { - "Text": "base64" } }, "body": [ @@ -1778,15 +1705,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "InlineBinary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -1798,6 +1716,15 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= }, "content_transfer_encoding": { "Text": "base64" + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } + } } }, "body": [ @@ -3114,9 +3041,6 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -3125,6 +3049,9 @@ eSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "blueball.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" } }, "body": [ diff --git a/tests/legacy/045.txt b/tests/legacy/045.txt index 8e087e1..cf473ff 100644 --- a/tests/legacy/045.txt +++ b/tests/legacy/045.txt @@ -56,18 +56,6 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= } } }, - "to": { - "AddressList": [ - { - "name": "Joe Blow", - "address": "blow@example.com" - }, - { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - ] - }, "date": { "DateTime": { "year": 2000, @@ -81,71 +69,31 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= "tz_minute": 0 } }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, "mime_version": { "Text": "1.0" }, + "to": { + "AddressList": [ + { + "name": "Joe Blow", + "address": "blow@example.com" + }, + { + "name": "Heinz Müller", + "address": "mueller@example.com" + } + ] + }, "from": { "Address": { "name": "Doug Sauder", "address": "doug@penguin.example.com" } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "date" - }, - "start": 5, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 91 - }, - { - "name": { - "Rfc": "to" - }, - "start": 94, - "end": 185 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 193, - "end": 240 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 251, - "end": 315 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 328, - "end": 334 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 347, - "end": 415 - } - ], "html_body": [ 0 ], @@ -175,6 +123,18 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= { "Text": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "attachment", + "c_subtype": null, + "attributes": { + "filename": "HasenundFrösche.txt" + } + } + }, + "content_transfer_encoding": { + "Text": "BASE64" + }, "content_type": { "ContentType": { "c_type": "text", @@ -188,20 +148,8 @@ bGljaGVyIHNlaW4gbfxzc2VuIGFscyB3aXIuIiANDQoNDQo= "content_id": { "Text": "Pine.LNX.4.21.0005191026120.8452@penguin.example.com" }, - "content_transfer_encoding": { - "Text": "BASE64" - }, "content_description": { "Text": "Short story in German" - }, - "content_disposition": { - "ContentType": { - "c_type": "attachment", - "c_subtype": null, - "attributes": { - "filename": "HasenundFrösche.txt" - } - } } }, "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 46dfcd8..1b2c650 100644 --- a/tests/legacy/046.txt +++ b/tests/legacy/046.txt @@ -47,21 +47,18 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." "tz_minute": 0 } }, - "subject": { - "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" - }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, - "message_id": { - "Text": "3923561C.B7078DEF@example.com" - }, "from": { "Address": { "name": "Doug Sauder", "address": "dwsauder@example.com" } }, + "to": { + "Address": { + "name": "Jürgen Schmürgen", + "address": "schmuergen@example.com" + } + }, "mime_version": { "Text": "1.0" }, @@ -74,93 +71,16 @@ welche also wohl noch ungl=FCcklicher sein m=FCssen als wir." } } }, - "to": { - "Address": { - "name": "Jürgen Schmürgen", - "address": "schmuergen@example.com" - } + "message_id": { + "Text": "3923561C.B7078DEF@example.com" + }, + "content_transfer_encoding": { + "Text": "quoted-printable" + }, + "subject": { + "Text": "Die Hasen und die Frösche (Netscape Communicator 4.7)" } }, - "headers_other": { - "X-Accept-Language": { - "Text": "en" - }, - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 277 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 285, - "end": 360 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 373, - "end": 406 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 432, - "end": 451 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/047.txt b/tests/legacy/047.txt index 590c8f3..9a0b326 100644 --- a/tests/legacy/047.txt +++ b/tests/legacy/047.txt @@ -65,9 +65,6 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "mime_version": { "Text": "1.0" }, - "subject": { - "Text": "Test message from Netscape Communicator 4.7" - }, "from": { "Address": { "name": "Doug Sauder", @@ -80,14 +77,8 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "address": "blow@example.com" } }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "------------CA611088711119FBDB3473B4" - } - } + "message_id": { + "Text": "392367BC.3D075C95@example.com" }, "date": { "DateTime": { @@ -102,83 +93,19 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "tz_minute": 0 } }, - "message_id": { - "Text": "392367BC.3D075C95@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-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 - } - ], "html_body": [ 0 ], @@ -192,9 +119,6 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -203,6 +127,9 @@ n wenig aufschieben, denn auch uns f=FCrchten, wie ihr seht, einige Tiere= "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, "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" diff --git a/tests/legacy/048.txt b/tests/legacy/048.txt index 42133eb..9d12290 100644 --- a/tests/legacy/048.txt +++ b/tests/legacy/048.txt @@ -166,18 +166,18 @@ end "subject": { "Text": "Test message from Netscape Communicator 4.7" }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, "message_id": { "Text": "3923670C.67D83A99@example.com" }, "mime_version": { "Text": "1.0" }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -201,79 +201,6 @@ end } } }, - "headers_other": { - "X-Mailer": { - "Text": "Mozilla 4.7 [en] (WinNT; I)" - }, - "X-Accept-Language": { - "Text": "en" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 45 - }, - { - "name": { - "Rfc": "date" - }, - "start": 50, - "end": 84 - }, - { - "name": { - "Rfc": "from" - }, - "start": 89, - "end": 126 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 135, - "end": 165 - }, - { - "name": { - "Other": "X-Accept-Language" - }, - "start": 183, - "end": 188 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 201, - "end": 207 - }, - { - "name": { - "Rfc": "to" - }, - "start": 210, - "end": 240 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 248, - "end": 294 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 307, - "end": 376 - } - ], "html_body": [ 0, 1, @@ -295,9 +222,6 @@ end { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -306,6 +230,9 @@ end "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, "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" @@ -314,9 +241,6 @@ end { "InlineBinary": { "headers": { - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_type": { "ContentType": { "c_type": "image", @@ -326,6 +250,9 @@ end } } }, + "content_transfer_encoding": { + "Text": "x-uuencode" + }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -2411,9 +2338,6 @@ end { "InlineBinary": { "headers": { - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -2431,6 +2355,9 @@ end "name": "greenball.png" } } + }, + "content_transfer_encoding": { + "Text": "x-uuencode" } }, "body": [ @@ -4290,6 +4217,9 @@ end { "InlineBinary": { "headers": { + "content_transfer_encoding": { + "Text": "x-uuencode" + }, "content_type": { "ContentType": { "c_type": "image", @@ -4299,9 +4229,6 @@ end } } }, - "content_transfer_encoding": { - "Text": "x-uuencode" - }, "content_disposition": { "ContentType": { "c_type": "inline", diff --git a/tests/legacy/049.txt b/tests/legacy/049.txt index 47f750f..983a727 100644 --- a/tests/legacy/049.txt +++ b/tests/legacy/049.txt @@ -133,14 +133,14 @@ end ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { + "from": { "Address": { - "name": "Joe Blow", - "address": "jblow@example.com" + "name": "Doug Sauder", + "address": "doug@example.com" } }, - "subject": { - "Text": "Test message from Microsoft Outlook 00" + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com" }, "date": { "DateTime": { @@ -155,105 +155,16 @@ end "tz_minute": 0 } }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGIEKGCHAA.doug@example.com" - }, - "from": { + "to": { "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" + "name": "Joe Blow", + "address": "jblow@example.com" } + }, + "subject": { + "Text": "Test message from Microsoft Outlook 00" } }, - "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-MimeOLE": { - "Text": "Produced By Microsoft MimeOLE V5.00.2314.1300" - }, - "X-MSMail-Priority": { - "Text": "Normal" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 76 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 84, - "end": 125 - }, - { - "name": { - "Rfc": "date" - }, - "start": 130, - "end": 164 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 175, - "end": 225 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 236, - "end": 249 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 267, - "end": 276 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 285, - "end": 338 - }, - { - "name": { - "Other": "Importance" - }, - "start": 349, - "end": 358 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 368, - "end": 416 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/050.txt b/tests/legacy/050.txt index db20698..6c433d6 100644 --- a/tests/legacy/050.txt +++ b/tests/legacy/050.txt @@ -111,6 +111,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "message_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" + }, + "subject": { + "Text": "Die Hasen und die Frösche" + }, "mime_version": { "Text": "1.0" }, @@ -119,11 +125,17 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715546120==_.REL", - "type": "text/html" + "type": "text/html", + "boundary": "=====================_715546120==_.REL" } } }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, "to": { "Address": { "name": "Heinz Müller", @@ -142,103 +154,8 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "tz_hour": 4, "tz_minute": 0 } - }, - "message_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com" - }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche" } }, - "headers_other": { - "X-Priority": { - "Text": "2 (High)" - }, - "X-Mailer": { - "Text": "QUALCOMM Windows Eudora Pro Version 4.2.0.58" - }, - "X-Sender": { - "Text": "dwsauder@pop.example.com (Unverified)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 508 - } - ], "html_body": [ 0 ], @@ -272,9 +189,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -284,9 +198,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, - "content_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2" - }, "content_type": { "ContentType": { "c_type": "image", @@ -295,6 +206,12 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== "name": "2aa658b6.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.2" } }, "body": [ @@ -1629,9 +1546,6 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== { "Binary": { "headers": { - "content_id": { - "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3" - }, "content_transfer_encoding": { "Text": "base64" }, @@ -1644,6 +1558,9 @@ IFl2ZXMgUGlndWV0NnM7vAAAAABJRU5ErkJggg== } } }, + "content_id": { + "Text": "4.2.0.58.20000519003934.00a866f0@pop.example.com.3" + }, "content_disposition": { "ContentType": { "c_type": "inline", diff --git a/tests/legacy/051.txt b/tests/legacy/051.txt index 633495e..a903e36 100644 --- a/tests/legacy/051.txt +++ b/tests/legacy/051.txt @@ -163,6 +163,25 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": "Doug Sauder", + "address": "dwsauder@example.com" + } + }, + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 19, + "hour": 0, + "minute": 39, + "second": 5, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } + }, "subject": { "Text": "Die Hasen und die Frösche" }, @@ -178,118 +197,16 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "message_id": { "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com" }, - "mime_version": { - "Text": "1.0" - }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 19, - "hour": 0, - "minute": 39, - "second": 5, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } - }, "to": { "Address": { "name": "Heinz Müller", "address": "mueller@example.com" } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "dwsauder@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)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "message_id" - }, - "start": 11, - "end": 64 - }, - { - "name": { - "Other": "X-Sender" - }, - "start": 73, - "end": 113 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 122, - "end": 170 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 181, - "end": 192 - }, - { - "name": { - "Rfc": "date" - }, - "start": 197, - "end": 231 - }, - { - "name": { - "Rfc": "to" - }, - "start": 234, - "end": 288 - }, - { - "name": { - "Rfc": "from" - }, - "start": 293, - "end": 330 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 338, - "end": 383 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 396, - "end": 402 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 415, - "end": 482 - } - ], "html_body": [ 1 ], @@ -310,8 +227,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "c_type": "multipart", "c_subtype": "related", "attributes": { - "boundary": "=====================_715515186==_.REL", - "type": "text/plain" + "type": "text/plain", + "boundary": "=====================_715515186==_.REL" } } } @@ -339,9 +256,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_transfer_encoding": { - "Text": "base64" - }, "content_disposition": { "ContentType": { "c_type": "inline", @@ -351,9 +265,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_id": { - "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2" - }, "content_type": { "ContentType": { "c_type": "image", @@ -362,6 +273,12 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "name": "2aa5e03a.png" } } + }, + "content_transfer_encoding": { + "Text": "base64" + }, + "content_id": { + "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.2" } }, "body": [ @@ -1699,15 +1616,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "content_id": { "Text": "4.2.0.58.20000519003903.00a859b0@pop.example.com.3" }, - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "2aa5e044.png" - } - } - }, "content_transfer_encoding": { "Text": "base64" }, @@ -1719,6 +1627,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= "filename": "2aa5e044.png" } } + }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "2aa5e044.png" + } + } } }, "body": [ @@ -3181,15 +3098,6 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "blueball.png" - } - } - }, "content_disposition": { "ContentType": { "c_type": "attachment", @@ -3199,6 +3107,15 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "blueball.png" + } + } + }, "content_transfer_encoding": { "Text": "base64" } @@ -4535,14 +4452,8 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= { "Binary": { "headers": { - "content_type": { - "ContentType": { - "c_type": "image", - "c_subtype": "png", - "attributes": { - "name": "greenball.png" - } - } + "content_transfer_encoding": { + "Text": "base64" }, "content_disposition": { "ContentType": { @@ -4553,8 +4464,14 @@ bGlwMmdpZiB2LjAuNiBieSBZdmVzIFBpZ3VldDZzO7wAAAAASUVORK5CYII= } } }, - "content_transfer_encoding": { - "Text": "base64" + "content_type": { + "ContentType": { + "c_type": "image", + "c_subtype": "png", + "attributes": { + "name": "greenball.png" + } + } } }, "body": [ diff --git a/tests/legacy/052.txt b/tests/legacy/052.txt index 3b4310e..6a3af50 100644 --- a/tests/legacy/052.txt +++ b/tests/legacy/052.txt @@ -29,8 +29,18 @@ welche also wohl noch ungl ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com" + "date": { + "DateTime": { + "year": 2000, + "month": 5, + "day": 17, + "hour": 19, + "minute": 28, + "second": 40, + "tz_before_gmt": true, + "tz_hour": 4, + "tz_minute": 0 + } }, "from": { "Address": { @@ -47,109 +57,10 @@ welche also wohl noch ungl "subject": { "Text": "Die Hasen und die Fr�sche (Microsoft Outlook 00)" }, - "date": { - "DateTime": { - "year": 2000, - "month": 5, - "day": 17, - "hour": 19, - "minute": 28, - "second": 40, - "tz_before_gmt": true, - "tz_hour": 4, - "tz_minute": 0 - } + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGOEKDCHAA.doug@example.com" } }, - "headers_other": { - "Importance": { - "Text": "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" - }, - "X-Priority": { - "Text": "3 (Normal)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 82 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 90, - "end": 141 - }, - { - "name": { - "Rfc": "date" - }, - "start": 146, - "end": 180 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 191, - "end": 241 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 252, - "end": 265 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 283, - "end": 292 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 301, - "end": 354 - }, - { - "name": { - "Other": "Importance" - }, - "start": 365, - "end": 374 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 384, - "end": 432 - } - ], "html_body": [ 0 ], diff --git a/tests/legacy/053.txt b/tests/legacy/053.txt index 0243bb9..9e849f5 100644 --- a/tests/legacy/053.txt +++ b/tests/legacy/053.txt @@ -37,9 +37,6 @@ als wir."=20 "mime_version": { "Text": "1.0" }, - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "date": { "DateTime": { "year": 2000, @@ -53,24 +50,6 @@ als wir."=20 "tz_minute": 0 } }, - "from": { - "Address": { - "name": "Doug Sauder", - "address": "doug@example.com" - } - }, - "subject": { - "Text": "Die Hasen und die Frösche (Microsoft Outlook 00)" - }, - "to": { - "Address": { - "name": "Heinz Müller", - "address": "mueller@example.com" - } - }, - "message_id": { - "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com" - }, "content_type": { "ContentType": { "c_type": "text", @@ -79,118 +58,29 @@ als wir."=20 "charset": "utf-8" } } + }, + "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" + } + }, + "from": { + "Address": { + "name": "Doug Sauder", + "address": "doug@example.com" + } + }, + "message_id": { + "Text": "NDBBIAKOPKHFGPLCODIGKEKDCHAA.doug@example.com" } }, - "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)" - }, - "Importance": { - "Text": "Normal" - }, - "X-Priority": { - "Text": "3 (Normal)" - } - }, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 40 - }, - { - "name": { - "Rfc": "to" - }, - "start": 43, - "end": 97 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 105, - "end": 177 - }, - { - "name": { - "Rfc": "date" - }, - "start": 182, - "end": 216 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 227, - "end": 277 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 290, - "end": 296 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 309, - "end": 341 - }, - { - "name": { - "Rfc": "content_transfer_encoding" - }, - "start": 367, - "end": 386 - }, - { - "name": { - "Other": "X-Priority" - }, - "start": 397, - "end": 410 - }, - { - "name": { - "Other": "X-MSMail-Priority" - }, - "start": 428, - "end": 437 - }, - { - "name": { - "Other": "X-Mailer" - }, - "start": 446, - "end": 499 - }, - { - "name": { - "Other": "Importance" - }, - "start": 510, - "end": 519 - }, - { - "name": { - "Other": "X-MimeOLE" - }, - "start": 529, - "end": 577 - } - ], "html_body": [ 0 ], diff --git a/tests/malformed/000.txt b/tests/malformed/000.txt index 53848b9..1850c03 100644 --- a/tests/malformed/000.txt +++ b/tests/malformed/000.txt @@ -22,58 +22,14 @@ Content-Type: text/html } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 47 - } - ], - "html_body": [ - 0, - 1 - ], - "text_body": [ - 0, - 1 - ], + "html_body": [], + "text_body": [], "attachments": [], - "parts": [ - { - "Text": { - "headers": {}, - "body": "Content-Type: text/plain" - } - }, - { - "Text": { - "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - } - }, - "body": "Content-Type: text/html" - } - } - ], + "parts": [], "structure": { - "List": [ - { - "Part": 0 - }, - { - "Part": 1 - } - ] + "List": [] }, "offset_header": 0, "offset_body": 48, - "offset_end": 159 + "offset_end": 160 } \ No newline at end of file diff --git a/tests/malformed/001.txt b/tests/malformed/001.txt index bf6f9a0..fb38893 100644 --- a/tests/malformed/001.txt +++ b/tests/malformed/001.txt @@ -22,16 +22,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 45 - } - ], "html_body": [ 1 ], diff --git a/tests/malformed/002.txt b/tests/malformed/002.txt index 5753fbc..1eef551 100644 --- a/tests/malformed/002.txt +++ b/tests/malformed/002.txt @@ -15,16 +15,6 @@ body } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 45 - } - ], "html_body": [], "text_body": [], "attachments": [ diff --git a/tests/malformed/003.txt b/tests/malformed/003.txt index 75a9e8d..bd5bc4a 100644 --- a/tests/malformed/003.txt +++ b/tests/malformed/003.txt @@ -21,16 +21,6 @@ body } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [], "text_body": [], "attachments": [ diff --git a/tests/malformed/004.txt b/tests/malformed/004.txt index bbfe9ca..a699fff 100644 --- a/tests/malformed/004.txt +++ b/tests/malformed/004.txt @@ -21,16 +21,6 @@ body } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [], "text_body": [], "attachments": [ diff --git a/tests/malformed/005.txt b/tests/malformed/005.txt index 7075d75..837c3fa 100644 --- a/tests/malformed/005.txt +++ b/tests/malformed/005.txt @@ -25,16 +25,6 @@ body2 } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 46 - } - ], "html_body": [ 1 ], diff --git a/tests/malformed/006.txt b/tests/malformed/006.txt index 2cc5c99..58820e7 100644 --- a/tests/malformed/006.txt +++ b/tests/malformed/006.txt @@ -21,16 +21,6 @@ body } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [], "text_body": [], "attachments": [ diff --git a/tests/malformed/007.txt b/tests/malformed/007.txt index 2813780..263b7e9 100644 --- a/tests/malformed/007.txt +++ b/tests/malformed/007.txt @@ -23,16 +23,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [], "text_body": [], "attachments": [ @@ -41,9 +31,6 @@ Content-Type: text/plain "parts": [ { "Multipart": { - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -52,6 +39,9 @@ Content-Type: text/plain "boundary": "ab" } } + }, + "mime_version": { + "Text": "1.0" } } }, diff --git a/tests/malformed/008.txt b/tests/malformed/008.txt index 2ca9a07..f8128ee 100644 --- a/tests/malformed/008.txt +++ b/tests/malformed/008.txt @@ -25,16 +25,6 @@ body2 } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 45 - } - ], "html_body": [], "text_body": [], "attachments": [ diff --git a/tests/malformed/009.txt b/tests/malformed/009.txt index c09688e..167bb7a 100644 --- a/tests/malformed/009.txt +++ b/tests/malformed/009.txt @@ -29,16 +29,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [ 1 ], diff --git a/tests/malformed/010.txt b/tests/malformed/010.txt index 6c8983f..1456f1d 100644 --- a/tests/malformed/010.txt +++ b/tests/malformed/010.txt @@ -17,16 +17,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 29 - } - ], "html_body": [], "text_body": [], "attachments": [ @@ -54,16 +44,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 43, - "end": 59 - } - ], "html_body": [], "text_body": [], "attachments": [ @@ -91,16 +71,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 73, - "end": 85 - } - ], "html_body": [ 0 ], diff --git a/tests/malformed/011.txt b/tests/malformed/011.txt index c09688e..167bb7a 100644 --- a/tests/malformed/011.txt +++ b/tests/malformed/011.txt @@ -29,16 +29,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [ 1 ], diff --git a/tests/malformed/012.txt b/tests/malformed/012.txt index 6b698aa..e63ce1d 100644 --- a/tests/malformed/012.txt +++ b/tests/malformed/012.txt @@ -35,16 +35,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [], "text_body": [], "attachments": [ @@ -86,16 +76,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 141, - "end": 153 - } - ], "html_body": [ 0 ], @@ -141,16 +121,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 203, - "end": 215 - } - ], "html_body": [], "text_body": [], "attachments": [ diff --git a/tests/malformed/013.txt b/tests/malformed/013.txt index 6d94117..299e660 100644 --- a/tests/malformed/013.txt +++ b/tests/malformed/013.txt @@ -34,6 +34,9 @@ hello, world ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -42,28 +45,8 @@ hello, world "boundary": "1" } } - }, - "mime_version": { - "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 57, - "end": 62 - } - ], "html_body": [ 0, 2, @@ -94,9 +77,6 @@ hello, world }, { "Multipart": { - "mime_version": { - "Text": "2.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -105,6 +85,9 @@ hello, world "boundary": "1" } } + }, + "mime_version": { + "Text": "2.0" } } }, diff --git a/tests/malformed/014.txt b/tests/malformed/014.txt index 6a6e6d1..03a04d6 100644 --- a/tests/malformed/014.txt +++ b/tests/malformed/014.txt @@ -19,16 +19,6 @@ hello, world } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [ 0 ], diff --git a/tests/malformed/015.txt b/tests/malformed/015.txt index 65cf22e..199ef94 100644 --- a/tests/malformed/015.txt +++ b/tests/malformed/015.txt @@ -27,23 +27,34 @@ invalid ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "message_id": { - "Text": "1.2.3.4@example" - }, - "from": { - "Address": { - "name": "Test User", - "address": "test@example.org" - } - }, "to": { "Address": { "name": "Another User", "address": "test2@example.org" } }, - "mime_version": { - "Text": "1.0" + "message_id": { + "Text": "1.2.3.4@example" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "signed", + "attributes": { + "boundary": "=-GNQXLhuj24Pl1aCkk4/d", + "micalg": "pgp-sha1", + "protocol": "application/pgp-signature" + } + } + }, + "subject": { + "Text": "Hello world" + }, + "from": { + "Address": { + "name": "Test User", + "address": "test@example.org" + } }, "date": { "DateTime": { @@ -58,83 +69,13 @@ invalid "tz_minute": 0 } }, - "subject": { - "Text": "Hello world" - }, "return_path": { "Text": "test@example.org" }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "signed", - "attributes": { - "protocol": "application/pgp-signature", - "boundary": "=-GNQXLhuj24Pl1aCkk4/d", - "micalg": "pgp-sha1" - } - } + "mime_version": { + "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "return_path" - }, - "start": 12, - "end": 32 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 40, - "end": 53 - }, - { - "name": { - "Rfc": "from" - }, - "start": 58, - "end": 88 - }, - { - "name": { - "Rfc": "to" - }, - "start": 91, - "end": 125 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 136, - "end": 155 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 168, - "end": 173 - }, - { - "name": { - "Rfc": "date" - }, - "start": 178, - "end": 211 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 224, - "end": 334 - } - ], "html_body": [ 0 ], @@ -148,15 +89,15 @@ invalid { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "body": "There was a day \na happy day\n" diff --git a/tests/malformed/016.txt b/tests/malformed/016.txt index f51ad7e..fb96c81 100644 --- a/tests/malformed/016.txt +++ b/tests/malformed/016.txt @@ -36,16 +36,6 @@ Content-Type: text/plain } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 125 - } - ], "html_body": [ 2 ], diff --git a/tests/rfc/000.txt b/tests/rfc/000.txt index efc2240..98f533a 100644 --- a/tests/rfc/000.txt +++ b/tests/rfc/000.txt @@ -74,10 +74,10 @@ Content-Transfer-Encoding: Quoted-printable ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { + "from": { "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" + "name": "Nathaniel Borenstein", + "address": "nsb@nsb.fv.com" } }, "date": { @@ -96,11 +96,8 @@ Content-Transfer-Encoding: Quoted-printable "mime_version": { "Text": "1.0" }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@nsb.fv.com" - } + "subject": { + "Text": "A multipart example" }, "content_type": { "ContentType": { @@ -111,55 +108,13 @@ Content-Transfer-Encoding: Quoted-printable } } }, - "subject": { - "Text": "A multipart example" + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "mime_version" - }, - "start": 13, - "end": 18 - }, - { - "name": { - "Rfc": "from" - }, - "start": 23, - "end": 62 - }, - { - "name": { - "Rfc": "to" - }, - "start": 65, - "end": 95 - }, - { - "name": { - "Rfc": "date" - }, - "start": 100, - "end": 139 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 147, - "end": 168 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 181, - "end": 238 - } - ], "html_body": [ 0, 1 @@ -277,11 +232,8 @@ Content-Transfer-Encoding: Quoted-printable "address": null } }, - "from": { - "Address": { - "name": "mailbox in US-ASCII", - "address": null - } + "content_transfer_encoding": { + "Text": "Quoted-printable" }, "content_type": { "ContentType": { @@ -292,51 +244,16 @@ Content-Transfer-Encoding: Quoted-printable } } }, + "from": { + "Address": { + "name": "mailbox in US-ASCII", + "address": null + } + }, "subject": { "Text": "(subject in US-ASCII)" - }, - "content_transfer_encoding": { - "Text": "Quoted-printable" } }, - "headers_other": {}, - "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 ], diff --git a/tests/rfc/001.txt b/tests/rfc/001.txt index 2ca695b..0cfd4e4 100644 --- a/tests/rfc/001.txt +++ b/tests/rfc/001.txt @@ -45,9 +45,6 @@ get RFC-MIME.DOC "mime_version": { "Text": "1.0" }, - "content_id": { - "Text": "id001@guppylake.bellcore.com" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -57,84 +54,28 @@ get RFC-MIME.DOC } } }, - "to": { - "Address": { - "name": "Someone", - "address": null - } - }, - "subject": { - "Text": "whatever" - }, - "message_id": { - "Text": "id1@host.com" - }, "from": { "Address": { "name": "Whomever", "address": null } + }, + "message_id": { + "Text": "id1@host.com" + }, + "content_id": { + "Text": "id001@guppylake.bellcore.com" + }, + "subject": { + "Text": "whatever" + }, + "to": { + "Address": { + "name": "Someone", + "address": null + } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 15 - }, - { - "name": { - "Rfc": "to" - }, - "start": 18, - "end": 27 - }, - { - "name": { - "Rfc": "date" - }, - "start": 32, - "end": 42 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 50, - "end": 60 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 73, - "end": 78 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 89, - "end": 105 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 118, - "end": 154 - }, - { - "name": { - "Rfc": "content_id" - }, - "start": 165, - "end": 197 - } - ], "html_body": [], "text_body": [], "attachments": [ @@ -151,12 +92,12 @@ get RFC-MIME.DOC "c_type": "message", "c_subtype": "external-body", "attributes": { - "directory": "pub", "access-type": "ANON-FTP", - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", + "site": "thumper.bellcore.com", "mode": "image", "name": "BodyFormats.ps", - "site": "thumper.bellcore.com" + "directory": "pub", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" } } } @@ -252,9 +193,9 @@ get RFC-MIME.DOC "c_type": "message", "c_subtype": "external-body", "attributes": { - "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "site": "thumper.bellcore.com", "access-type": "local-file", + "site": "thumper.bellcore.com", + "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", "name": "/u/nsb/writing/rfcs/RFC-MIME.ps" } } @@ -351,9 +292,9 @@ get RFC-MIME.DOC "c_type": "message", "c_subtype": "external-body", "attributes": { + "server": "listserv@bogus.bitnet", "expiration": "Fri, 14 Jun 1991 19:13:14 -0400 (EDT)", - "access-type": "mail-server", - "server": "listserv@bogus.bitnet" + "access-type": "mail-server" } } } diff --git a/tests/rfc/002.txt b/tests/rfc/002.txt index 28ff403..4d3802f 100644 --- a/tests/rfc/002.txt +++ b/tests/rfc/002.txt @@ -74,18 +74,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "to": { - "Address": { - "name": "White House Transportation Coordinator", - "address": "transport@whitehouse.gov" - } - }, - "from": { - "Address": { - "name": "Al Gore", - "address": "vice-president@whitehouse.gov" - } - }, "subject": { "Text": "[Fwd: Map of Argentina with Description]" }, @@ -97,39 +85,20 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "boundary": "D7F------------D7FD5A0B8AB9C65CCDBFA872" } } + }, + "from": { + "Address": { + "name": "Al Gore", + "address": "vice-president@whitehouse.gov" + } + }, + "to": { + "Address": { + "name": "White House Transportation Coordinator", + "address": "transport@whitehouse.gov" + } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 47 - }, - { - "name": { - "Rfc": "to" - }, - "start": 50, - "end": 123 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 131, - "end": 173 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 186, - "end": 269 - } - ], "html_body": [ 0 ], @@ -143,9 +112,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -154,6 +120,9 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, "body": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl" @@ -165,19 +134,19 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "content_transfer_encoding": { "Text": "7bit" }, - "content_type": { - "ContentType": { - "c_type": "message", - "c_subtype": "rfc822", - "attributes": null - } - }, "content_disposition": { "ContentType": { "c_type": "inline", "c_subtype": null, "attributes": null } + }, + "content_type": { + "ContentType": { + "c_type": "message", + "c_subtype": "rfc822", + "attributes": null + } } }, "body": { @@ -192,8 +161,17 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz } ] }, - "message_id": { - "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" + "return_path": { + "Text": "president@whitehouse.gov" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "DC8------------DC8638F443D87A7F0726DEF7" + } + } }, "date": { "DateTime": { @@ -208,6 +186,9 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "tz_minute": 0 } }, + "message_id": { + "Text": "199804130742.RAA20366@mai1host.whitehouse.gov" + }, "from": { "Address": { "name": "Bill Clinton", @@ -220,18 +201,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "address": "vice-president@whitehouse.gov" } }, - "return_path": { - "Text": "president@whitehouse.gov" - }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "DC8------------DC8638F443D87A7F0726DEF7" - } - } - }, "subject": { "Text": "Map of Argentina with Description" }, @@ -239,79 +208,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "Text": "1.0" } }, - "headers_other": {}, - "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 @@ -327,6 +223,9 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -335,9 +234,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz "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" @@ -346,6 +242,15 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz { "InlineBinary": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": { + "fi1ename": "map_of_Argentina.gif" + } + } + }, "content_type": { "ContentType": { "c_type": "image", @@ -357,15 +262,6 @@ U6ZGxseyk8SasGw3J9GRzdTQky1iHNvcPNNI4TLeKdfMvy0vMqLrItvuxfDW8ubjueDtJufz }, "content_transfer_encoding": { "Text": "base64" - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": { - "fi1ename": "map_of_Argentina.gif" - } - } } }, "body": [ diff --git a/tests/rfc/003.txt b/tests/rfc/003.txt index cb86761..dbe1c54 100644 --- a/tests/rfc/003.txt +++ b/tests/rfc/003.txt @@ -26,6 +26,18 @@ Content-Type: application/x-whatever ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": "Nathaniel Borenstein", + "address": "nsb@bellcore.com" + } + }, + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } + }, "subject": { "Text": "Formatted text mail" }, @@ -41,18 +53,6 @@ Content-Type: application/x-whatever "mime_version": { "Text": "1.0" }, - "from": { - "Address": { - "name": "Nathaniel Borenstein", - "address": "nsb@bellcore.com" - } - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, "date": { "DateTime": { "year": 1993, @@ -67,51 +67,6 @@ Content-Type: application/x-whatever } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 46 - }, - { - "name": { - "Rfc": "to" - }, - "start": 49, - "end": 79 - }, - { - "name": { - "Rfc": "date" - }, - "start": 84, - "end": 123 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 131, - "end": 152 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 165, - "end": 170 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 183, - "end": 227 - } - ], "html_body": [ 0 ], diff --git a/tests/rfc/004.txt b/tests/rfc/004.txt index 38409c8..068ae30 100644 --- a/tests/rfc/004.txt +++ b/tests/rfc/004.txt @@ -37,18 +37,15 @@ Subject: my different opinion ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, - "to": { - "Address": { - "name": "Recipient-List", - "address": null + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "---- main boundary ----" + } } }, - "subject": { - "Text": "Internet Digest, volume 42" - }, "date": { "DateTime": { "year": 1994, @@ -62,67 +59,25 @@ Subject: my different opinion "tz_minute": 0 } }, - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "---- main boundary ----" - } - } - }, "from": { "Address": { "name": "Moderator-Address", "address": null } + }, + "to": { + "Address": { + "name": "Recipient-List", + "address": null + } + }, + "subject": { + "Text": "Internet Digest, volume 42" + }, + "mime_version": { + "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 24 - }, - { - "name": { - "Rfc": "to" - }, - "start": 27, - "end": 43 - }, - { - "name": { - "Rfc": "date" - }, - "start": 48, - "end": 81 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 89, - "end": 117 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 130, - "end": 135 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 148, - "end": 213 - } - ], "html_body": [ 0 ], @@ -166,6 +121,15 @@ Subject: my different opinion }, "body": { "headers_rfc": { + "subject": { + "Text": "my opinion" + }, + "from": { + "Address": { + "name": "someone-else", + "address": null + } + }, "date": { "DateTime": { "year": 1993, @@ -178,41 +142,8 @@ Subject: my different opinion "tz_hour": 2, "tz_minute": 0 } - }, - "from": { - "Address": { - "name": "someone-else", - "address": null - } - }, - "subject": { - "Text": "my opinion" } }, - "headers_other": {}, - "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 ], @@ -250,6 +181,9 @@ Subject: my different opinion }, "body": { "headers_rfc": { + "subject": { + "Text": "my different opinion" + }, "date": { "DateTime": { "year": 1993, @@ -263,9 +197,6 @@ Subject: my different opinion "tz_minute": 0 } }, - "subject": { - "Text": "my different opinion" - }, "from": { "Address": { "name": "someone-else-again", @@ -273,30 +204,6 @@ Subject: my different opinion } } }, - "headers_other": {}, - "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 ], diff --git a/tests/rfc/005.txt b/tests/rfc/005.txt index 4043e21..7b52f75 100644 --- a/tests/rfc/005.txt +++ b/tests/rfc/005.txt @@ -26,15 +26,6 @@ This is the epilogue. It is also to be ignored. ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "Sample message" - }, - "to": { - "Address": { - "name": "Ned Freed", - "address": "ned@innosoft.com" - } - }, "from": { "Address": { "name": "Nathaniel Borenstein", @@ -54,6 +45,18 @@ This is the epilogue. It is also to be ignored. "tz_minute": 0 } }, + "subject": { + "Text": "Sample message" + }, + "to": { + "Address": { + "name": "Ned Freed", + "address": "ned@innosoft.com" + } + }, + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -62,56 +65,8 @@ This is the epilogue. It is also to be ignored. "boundary": "simple boundary" } } - }, - "mime_version": { - "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 46 - }, - { - "name": { - "Rfc": "to" - }, - "start": 49, - "end": 79 - }, - { - "name": { - "Rfc": "date" - }, - "start": 84, - "end": 123 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 131, - "end": 147 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 160, - "end": 165 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 178, - "end": 223 - } - ], "html_body": [ 0, 1 diff --git a/tests/rfc/006.txt b/tests/rfc/006.txt index d64e48e..d4572cd 100644 --- a/tests/rfc/006.txt +++ b/tests/rfc/006.txt @@ -24,6 +24,12 @@ Content-Disposition: inline ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "from": { + "Address": { + "name": null, + "address": "sender@example.com" + } + }, "subject": { "Text": "Multipart Email Example" }, @@ -33,12 +39,6 @@ Content-Disposition: inline "address": "recipient@example.com" } }, - "from": { - "Address": { - "name": null, - "address": "sender@example.com" - } - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -49,37 +49,6 @@ Content-Disposition: inline } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 25 - }, - { - "name": { - "Rfc": "to" - }, - "start": 28, - "end": 51 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 59, - "end": 84 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 97, - "end": 148 - } - ], "html_body": [ 1 ], @@ -91,6 +60,13 @@ Content-Disposition: inline { "Text": { "headers": { + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } + }, "content_transfer_encoding": { "Text": "quoted-printable" }, @@ -102,13 +78,6 @@ Content-Disposition: inline "charset": "utf-8" } } - }, - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } } }, "body": "Plain text email goes here!\nThis is the fallback if email client does not support HTML\n" @@ -117,15 +86,6 @@ Content-Disposition: inline { "Html": { "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "html", - "attributes": { - "charset": "utf-8" - } - } - }, "content_transfer_encoding": { "Text": "quoted-printable" }, @@ -135,6 +95,15 @@ Content-Disposition: inline "c_subtype": null, "attributes": null } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "html", + "attributes": { + "charset": "utf-8" + } + } } }, "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 a8b932b..8ce792d 100644 --- a/tests/rfc/007.txt +++ b/tests/rfc/007.txt @@ -74,6 +74,9 @@ K ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "subject": { + "Text": "RFC 8621 Section 4.1.4 test" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -82,28 +85,8 @@ K "boundary": "1" } } - }, - "subject": { - "Text": "RFC 8621 Section 4.1.4 test" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 37 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 50, - "end": 81 - } - ], "html_body": [ 0, 8, @@ -127,19 +110,19 @@ K { "Text": { "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - }, "content_disposition": { "ContentType": { "c_type": "inline", "c_subtype": null, "attributes": null } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } } }, "body": "A" @@ -187,19 +170,19 @@ K { "Text": { "headers": { - "content_type": { - "ContentType": { - "c_type": "text", - "c_subtype": "plain", - "attributes": null - } - }, "content_disposition": { "ContentType": { "c_type": "inline", "c_subtype": null, "attributes": null } + }, + "content_type": { + "ContentType": { + "c_type": "text", + "c_subtype": "plain", + "attributes": null + } } }, "body": "B" @@ -348,16 +331,6 @@ K "Text": "J" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 789, - "end": 792 - } - ], "html_body": [ 0 ], @@ -385,19 +358,19 @@ K { "Text": { "headers": { - "content_disposition": { - "ContentType": { - "c_type": "inline", - "c_subtype": null, - "attributes": null - } - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_disposition": { + "ContentType": { + "c_type": "inline", + "c_subtype": null, + "attributes": null + } } }, "body": "K" diff --git a/tests/rfc/008.txt b/tests/rfc/008.txt index 49277af..b35c3a7 100644 --- a/tests/rfc/008.txt +++ b/tests/rfc/008.txt @@ -41,16 +41,6 @@ YWFhYWFhYWFhYWFhYS0tDQo= } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 82 - } - ], "html_body": [ 0 ], @@ -64,9 +54,6 @@ YWFhYWFhYWFhYWFhYS0tDQo= { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -75,6 +62,9 @@ YWFhYWFhYWFhYWFhYS0tDQo= "charset": "utf-8" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, "body": "This is a message with a base64 encoded attached email" @@ -108,21 +98,9 @@ YWFhYWFhYWFhYWFhYS0tDQo= "content_language": { "Text": "en-US" }, - "to": { - "Address": { - "name": "email@example.com", - "address": "email@example.com" - } - }, "subject": { "Text": "HTML test" }, - "from": { - "Address": { - "name": "Name", - "address": "email@example.com" - } - }, "message_id": { "Text": "random-message-id@example.com" }, @@ -150,67 +128,20 @@ YWFhYWFhYWFhYWFhYS0tDQo= "boundary": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } } + }, + "from": { + "Address": { + "name": "Name", + "address": "email@example.com" + } + }, + "to": { + "Address": { + "name": "email@example.com", + "address": "email@example.com" + } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "to" - }, - "start": 3, - "end": 45 - }, - { - "name": { - "Rfc": "from" - }, - "start": 50, - "end": 77 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 85, - "end": 97 - }, - { - "name": { - "Rfc": "message_id" - }, - "start": 108, - "end": 142 - }, - { - "name": { - "Rfc": "date" - }, - "start": 147, - "end": 181 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 194, - "end": 200 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 213, - "end": 292 - }, - { - "name": { - "Rfc": "content_language" - }, - "start": 309, - "end": 317 - } - ], "html_body": [ 1 ], @@ -222,18 +153,18 @@ YWFhYWFhYWFhYWFhYS0tDQo= { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7bit" + }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": { - "charset": "utf-8", - "format": "flowed" + "format": "flowed", + "charset": "utf-8" } } - }, - "content_transfer_encoding": { - "Text": "7bit" } }, "body": "This is an *HTML* test message\r" diff --git a/tests/thirdparty/000.txt b/tests/thirdparty/000.txt index 4eaad4c..f44a58c 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,28 +32,8 @@ ZWg= "boundary": "bound" } } - }, - "mime_version": { - "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "mime_version" - }, - "start": 13, - "end": 19 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 32, - "end": 76 - } - ], "html_body": [ 0, 1 diff --git a/tests/thirdparty/001.txt b/tests/thirdparty/001.txt index fe06c60..9400c49 100644 --- a/tests/thirdparty/001.txt +++ b/tests/thirdparty/001.txt @@ -26,9 +26,6 @@ hello world ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -37,25 +34,11 @@ hello world "boundary": "bound" } } + }, + "mime_version": { + "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "mime_version" - }, - "start": 13, - "end": 19 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 32, - "end": 76 - } - ], "html_body": [ 0, 1, diff --git a/tests/thirdparty/002.txt b/tests/thirdparty/002.txt index 46c312c..8931301 100644 --- a/tests/thirdparty/002.txt +++ b/tests/thirdparty/002.txt @@ -31,16 +31,6 @@ Content-Type: text/plain; charset=utf-8 } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - } - ], "html_body": [ 0, 1 @@ -56,9 +46,6 @@ Content-Type: text/plain; charset=utf-8 { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "quoted-printable" - }, "content_type": { "ContentType": { "c_type": "text", @@ -67,6 +54,9 @@ Content-Type: text/plain; charset=utf-8 "charset": "utf-8" } } + }, + "content_transfer_encoding": { + "Text": "quoted-printable" } }, "body": "päivää\n" diff --git a/tests/thirdparty/003.txt b/tests/thirdparty/003.txt index 728967b..0d834bb 100644 --- a/tests/thirdparty/003.txt +++ b/tests/thirdparty/003.txt @@ -49,23 +49,6 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 57, - "end": 62 - } - ], "html_body": [ 0, 1, @@ -85,9 +68,6 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "7bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -96,6 +76,9 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "charset": "us-ascii" } } + }, + "content_transfer_encoding": { + "Text": "7bit" } }, "body": "Move black king to queen's bishop\n" @@ -142,6 +125,9 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "quoted-printable" + }, "content_type": { "ContentType": { "c_type": "text", @@ -150,9 +136,6 @@ TW92ZSDimZogdG8g4pmbJ3Mg4pmdCg== "charset": "UTF-8" } } - }, - "content_transfer_encoding": { - "Text": "quoted-printable" } }, "body": "Move ♚ to ♛'s ♝\n" diff --git a/tests/thirdparty/004.txt b/tests/thirdparty/004.txt index f1d5a61..f1c5eee 100644 --- a/tests/thirdparty/004.txt +++ b/tests/thirdparty/004.txt @@ -42,9 +42,6 @@ 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", @@ -53,25 +50,11 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "boundary": "1" } } + }, + "mime_version": { + "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "content_type" - }, - "start": 13, - "end": 44 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 57, - "end": 62 - } - ], "html_body": [ 0, 1, @@ -93,6 +76,9 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "6bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -101,9 +87,6 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "charset": "UTF-8" } } - }, - "content_transfer_encoding": { - "Text": "6bit" } }, "body": "Move black king to queen's bishop\n" @@ -131,9 +114,6 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "8 bit" - }, "content_type": { "ContentType": { "c_type": "text", @@ -142,6 +122,9 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "charset": "UTF-8" } } + }, + "content_transfer_encoding": { + "Text": "8 bit" } }, "body": "Move ♚ to ♛'s ♝\n" @@ -150,6 +133,9 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D { "Text": { "headers": { + "content_transfer_encoding": { + "Text": "7-bit" + }, "content_type": { "ContentType": { "c_type": "text", @@ -158,9 +144,6 @@ Move =E2=99=9A to =E2=99=9B's =E2=99=9D "charset": "UTF-8" } } - }, - "content_transfer_encoding": { - "Text": "7-bit" } }, "body": "Move ♚ to ♛'s ♝\n" diff --git a/tests/thirdparty/005.txt b/tests/thirdparty/005.txt index 094658c..0fd4238 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 a1cea4b..021e77f 100644 --- a/tests/thirdparty/006.txt +++ b/tests/thirdparty/006.txt @@ -31,12 +31,6 @@ Signed by undersigned ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "subject": { - "Text": "Hide and seek" - }, - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -45,32 +39,14 @@ Signed by undersigned "boundary": "1" } } + }, + "subject": { + "Text": "Hide and seek" + }, + "mime_version": { + "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 23 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 36, - "end": 41 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 54, - "end": 83 - } - ], "html_body": [ 2 ], @@ -88,9 +64,9 @@ Signed by undersigned "c_type": "multipart", "c_subtype": "signed", "attributes": { - "migalc": "pen+paper", "protocol": "signature/plain", - "boundary": "2" + "boundary": "2", + "migalc": "pen+paper" } } } diff --git a/tests/thirdparty/007.txt b/tests/thirdparty/007.txt index f4a692d..574fae0 100644 --- a/tests/thirdparty/007.txt +++ b/tests/thirdparty/007.txt @@ -51,23 +51,6 @@ Foobar } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 5, - "end": 36 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 49, - "end": 80 - } - ], "html_body": [], "text_body": [], "attachments": [ @@ -89,33 +72,16 @@ Foobar }, "body": { "headers_rfc": { - "subject": { - "Text": "my opinion" - }, "from": { "Address": { "name": "someone-else", "address": "someone@else" } + }, + "subject": { + "Text": "my opinion" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 92, - "end": 121 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 129, - "end": 141 - } - ], "html_body": [ 0 ], @@ -163,23 +129,6 @@ Foobar } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 171, - "end": 198 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 206, - "end": 218 - } - ], "html_body": [ 0 ], @@ -217,15 +166,6 @@ Foobar }, "body": { "headers_rfc": { - "content_type": { - "ContentType": { - "c_type": "multipart", - "c_subtype": "mixed", - "attributes": { - "boundary": "2" - } - } - }, "from": { "Address": { "name": "attachment", @@ -234,32 +174,17 @@ Foobar }, "subject": { "Text": "funny hat" + }, + "content_type": { + "ContentType": { + "c_type": "multipart", + "c_subtype": "mixed", + "attributes": { + "boundary": "2" + } + } } }, - "headers_other": {}, - "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 ], @@ -273,15 +198,15 @@ Foobar { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "binary" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_transfer_encoding": { + "Text": "binary" } }, "body": "Lovely attachment for you" diff --git a/tests/thirdparty/008.txt b/tests/thirdparty/008.txt index 20a5eef..ba0f7be 100644 --- a/tests/thirdparty/008.txt +++ b/tests/thirdparty/008.txt @@ -58,12 +58,6 @@ Root MIME epilogue ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "from": { - "Address": { - "name": null, - "address": "user@domain.org" - } - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -86,52 +80,16 @@ Root MIME epilogue "tz_minute": 0 } }, + "from": { + "Address": { + "name": null, + "address": "user@domain.org" + } + }, "mime_version": { "Text": "1.0" } }, - "headers_other": { - "From user@domain Fri Feb 22 17": { - "Text": "06:23 2008" - } - }, - "headers_offsets": [ - { - "name": { - "Other": "From user@domain Fri Feb 22 17" - }, - "start": 32, - "end": 43 - }, - { - "name": { - "Rfc": "from" - }, - "start": 48, - "end": 65 - }, - { - "name": { - "Rfc": "date" - }, - "start": 70, - "end": 103 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 116, - "end": 121 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 134, - "end": 171 - } - ], "html_body": [ 2 ], @@ -175,6 +133,12 @@ Root MIME epilogue "subject": { "Text": "submsg" }, + "from": { + "Address": { + "name": null, + "address": "sub@domain.org" + } + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -184,12 +148,6 @@ Root MIME epilogue } } }, - "from": { - "Address": { - "name": null, - "address": "sub@domain.org" - } - }, "date": { "DateTime": { "year": 2012, @@ -204,37 +162,6 @@ Root MIME epilogue } } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "from" - }, - "start": 300, - "end": 316 - }, - { - "name": { - "Rfc": "date" - }, - "start": 321, - "end": 354 - }, - { - "name": { - "Rfc": "subject" - }, - "start": 362, - "end": 370 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 383, - "end": 423 - } - ], "html_body": [ 0, 4 diff --git a/tests/thirdparty/009.txt b/tests/thirdparty/009.txt index ca7867b..51cc061 100644 --- a/tests/thirdparty/009.txt +++ b/tests/thirdparty/009.txt @@ -22,9 +22,6 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= ---- EXPECTED STRUCTURE ---- { "headers_rfc": { - "mime_version": { - "Text": "1.0" - }, "content_type": { "ContentType": { "c_type": "multipart", @@ -34,34 +31,13 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= } } }, + "mime_version": { + "Text": "1.0" + }, "subject": { "Text": "In parts" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 18 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 31, - "end": 36 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 49, - "end": 78 - } - ], "html_body": [ 0 ], @@ -75,15 +51,15 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= { "Text": { "headers": { - "content_transfer_encoding": { - "Text": "binary" - }, "content_type": { "ContentType": { "c_type": "text", "c_subtype": "plain", "attributes": null } + }, + "content_transfer_encoding": { + "Text": "binary" } }, "body": "Hi, this is the fancy thing I was talking about!" @@ -97,8 +73,8 @@ dGhpcyBpcyB0aGUgZmlyc3QgcGFydCBvZiB0aGUgbWVzc2FnZQo= "c_type": "message", "c_subtype": "partial", "attributes": { - "total": "5", "id": "heks68ewe@example.org", + "total": "5", "number": "1" } } diff --git a/tests/thirdparty/010.txt b/tests/thirdparty/010.txt index 7736ec0..404f5f9 100644 --- a/tests/thirdparty/010.txt +++ b/tests/thirdparty/010.txt @@ -13,6 +13,9 @@ Content-Language: ja ---- EXPECTED STRUCTURE ---- { "headers_rfc": { + "mime_version": { + "Text": "1.0" + }, "content_type": { "ContentType": { "c_type": "multipart", @@ -25,35 +28,8 @@ Content-Language: ja }, "subject": { "Text": "こんにちは" - }, - "mime_version": { - "Text": "1.0" } }, - "headers_other": {}, - "headers_offsets": [ - { - "name": { - "Rfc": "subject" - }, - "start": 8, - "end": 42 - }, - { - "name": { - "Rfc": "mime_version" - }, - "start": 55, - "end": 60 - }, - { - "name": { - "Rfc": "content_type" - }, - "start": 73, - "end": 145 - } - ], "html_body": [ 0 ],