extern crate email_format; use email_format::Email; #[test] fn main() { let body = "Good to hear from you, Hans Müeller.\r\n\ I wish you the best.\r\n\ \r\n\ Your Friend,\r\n\ 黛安娜"; let mut email = Email::new( "myself@mydomain.com", // "From:" "Wed, 05 Jan 2015 15:13:05 +1300" // "Date:" ).unwrap(); email.set_sender("from_myself@mydomain.com").unwrap(); email.set_reply_to("My Mailer ").unwrap(); email.set_to("You ").unwrap(); email.set_cc("Our Friend ").unwrap(); email.set_message_id("").unwrap(); email.set_subject("Hello Friend").unwrap(); email.add_optional_field(("MIME-Version", "1.0")).unwrap(); email.add_optional_field(("Content-Type", "text/plain; charset=\"utf8\"")).unwrap(); email.set_body(body).unwrap(); println!("{}", email); }