extern crate emailmessage; use emailmessage::{header, Message, MultiPart, SinglePart}; fn main() { let m: Message> = Message::builder() .from("NoBody ".parse().unwrap()) .reply_to("Yuin ".parse().unwrap()) .to("Hei ".parse().unwrap()) .subject("Happy new year") .mime_body( MultiPart::mixed() .multipart( MultiPart::alternative() .singlepart( SinglePart::quoted_printable() .header(header::ContentType("text/plain; charset=utf8".parse().unwrap())) .body("Привет, мир!") ) .multipart( MultiPart::related() .singlepart( SinglePart::eight_bit() .header(header::ContentType("text/html; charset=utf8".parse().unwrap())) .body("

Hello, world!

") ) .singlepart( SinglePart::base64() .header(header::ContentType("image/png".parse().unwrap())) .header(header::ContentDisposition { disposition: header::DispositionType::Inline, parameters: vec![], }) .body("") ) ) ) .singlepart( SinglePart::seven_bit() .header(header::ContentType("text/plain; charset=utf8".parse().unwrap())) .header(header::ContentDisposition { disposition: header::DispositionType::Attachment, parameters: vec![ header::DispositionParam::Filename( header::Charset::Ext("utf-8".into()), None, "example.c".as_bytes().into() ) ] }) .body("int main() { return 0; }") ) ); println!("{}", m); }