diff --git a/README.md b/README.md index 5cbf4dc..0dab167 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ A tiny Outlook Email Message (.msg) reader ======================================= -A tiny reader for .msg files. +A tiny reader for .msg files. Supports embedded messages. ### Usage Example @@ -10,13 +10,46 @@ use tiny_msg::Email; fn main() { let email = Email::from_path("sample/sample1.msg"); + // basic headers + println!("From: {:?}", email.from.unwrap()); + println!("To: {:?}", email.to); + println!("Cc: {:?}", email.cc); + println!("Subject: {}", email.subject.unwrap()); + println!(); + // email body + println!("Body starts with: {:?}", &email.body.unwrap()[..50]); + println!(); + // attachments + println!( + "Attachments: {:?}", + email + .attachments + .iter() + .map(|a| a.name.clone()) + .collect::>() + ); + println!(); + // embedded messages + println!( + "Embedded Messages: {:?}", + email + .embedded_messages + .iter() + .map(|m| m.subject.as_ref().unwrap()) + .collect::>() + ); + println!(); + // OUTPUT: + // From: ("spoj", "spoj@example.com") + // To: [("john", "john@example.com")] + // Cc: [("karen", "karen@example.com")] + // Subject: Weekend plan - dbg!(&email.from); - dbg!(&email.to); - dbg!(&email.cc); - dbg!(&email.sent_date); - dbg!(&email.subject); - dbg!(&email.body); + // Body starts with: ">() + ); + println!(); + // embedded messages + println!( + "Embedded Messages: {:?}", + email + .embedded_messages + .iter() + .map(|m| m.subject.as_ref().unwrap()) + .collect::>() + ); + println!(); + // OUTPUT: + // From: ("spoj", "spoj@example.com") + // To: [("john", "john@example.com")] + // Cc: [("karen", "karen@example.com")] + // Subject: Weekend plan - dbg!(&email.from); - dbg!(&email.to); - dbg!(&email.cc); - dbg!(&email.sent_date); - dbg!(&email.subject); - dbg!(&email.body); + // Body starts with: "