use std::fs::File;
use mail_builder::{headers::url::URL, MessageBuilder};
fn main() {
MessageBuilder::new()
.from(("John Doe", "john@doe.com"))
.to(vec![
("Antoine de Saint-Exupéry", "antoine@exupery.com"),
("안녕하세요 세계", "test@test.com"),
("Xin chào", "addr@addr.com"),
])
.bcc(vec![
(
"My Group",
vec![
("ASCII name", "addr1@addr7.com"),
("ハロー・ワールド", "addr2@addr6.com"),
("áéíóú", "addr3@addr5.com"),
("Γειά σου Κόσμε", "addr4@addr4.com"),
],
),
(
"Another Group",
vec![
("שלום עולם", "addr5@addr3.com"),
("ñandú come ñoquis", "addr6@addr2.com"),
("Recipient", "addr7@addr1.com"),
],
),
])
.subject("Testing multipart messages") .in_reply_to(vec!["message-id-1", "message-id-2"])
.header("List-Archive", URL::new("http://example.com/archive"))
.text_body("This is the text body!\n") .html_body("<p>HTML body with <img src=\"cid:my-image\"/>!</p>") .inline("image/png", "cid:my-image", [0, 1, 2, 3, 4, 5].as_ref())
.attachment("text/plain", "my fíle.txt", "Attachment contents go here.") .attachment(
"text/plain",
"ハロー・ワールド",
b"Binary contents go here.".as_ref(),
)
.write_to(File::create("message.eml").unwrap())
.unwrap();
}