refactor: Message body encoder

This commit is contained in:
Paolo Barbolini
2020-12-06 16:23:33 +01:00
parent d3c73d8bd7
commit 170e929a2b
6 changed files with 496 additions and 307 deletions
+4 -4
View File
@@ -26,18 +26,18 @@ fn main() {
.multipart(
MultiPart::alternative() // This is composed of two parts.
.singlepart(
SinglePart::eight_bit()
SinglePart::builder()
.header(header::ContentType(
"text/plain; charset=utf8".parse().unwrap(),
))
.body("Hello from Lettre! A mailer library for Rust"), // Every message should have a plain text fallback.
.body(String::from("Hello from Lettre! A mailer library for Rust")), // Every message should have a plain text fallback.
)
.singlepart(
SinglePart::quoted_printable()
SinglePart::builder()
.header(header::ContentType(
"text/html; charset=utf8".parse().unwrap(),
))
.body(html),
.body(String::from(html)),
),
)
.expect("failed to build email");