Simplify header formatting and fix nightly build (fixes #340)
This commit is contained in:
@@ -127,7 +127,7 @@ impl PartBuilder {
|
|||||||
|
|
||||||
/// Adds a `ContentType` header with the given MIME type
|
/// Adds a `ContentType` header with the given MIME type
|
||||||
pub fn content_type(self, content_type: &Mime) -> PartBuilder {
|
pub fn content_type(self, content_type: &Mime) -> PartBuilder {
|
||||||
self.header(("Content-Type", format!("{}", content_type).as_ref()))
|
self.header(("Content-Type", content_type.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds a child part
|
/// Adds a child part
|
||||||
@@ -299,7 +299,7 @@ impl EmailBuilder {
|
|||||||
.body(body)
|
.body(body)
|
||||||
.header((
|
.header((
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
format!("{}", mime::TEXT_PLAIN_UTF_8).as_ref(),
|
mime::TEXT_PLAIN_UTF_8.to_string(),
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
self.child(text)
|
self.child(text)
|
||||||
@@ -311,7 +311,7 @@ impl EmailBuilder {
|
|||||||
.body(body)
|
.body(body)
|
||||||
.header((
|
.header((
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
format!("{}", mime::TEXT_HTML_UTF_8).as_ref(),
|
mime::TEXT_HTML_UTF_8.to_string(),
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
self.child(html)
|
self.child(html)
|
||||||
@@ -327,7 +327,7 @@ impl EmailBuilder {
|
|||||||
.body(body_text)
|
.body(body_text)
|
||||||
.header((
|
.header((
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
format!("{}", mime::TEXT_PLAIN_UTF_8).as_ref(),
|
mime::TEXT_PLAIN_UTF_8.to_string(),
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ impl EmailBuilder {
|
|||||||
.body(body_html)
|
.body(body_html)
|
||||||
.header((
|
.header((
|
||||||
"Content-Type",
|
"Content-Type",
|
||||||
format!("{}", mime::TEXT_HTML_UTF_8).as_ref(),
|
mime::TEXT_HTML_UTF_8.to_string(),
|
||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ impl EmailBuilder {
|
|||||||
}
|
}
|
||||||
// Add the sender header, if any.
|
// Add the sender header, if any.
|
||||||
if let Some(ref v) = self.sender {
|
if let Some(ref v) = self.sender {
|
||||||
self.message = self.message.header(("Sender", v.to_string().as_ref()));
|
self.message = self.message.header(("Sender", v.to_string()));
|
||||||
}
|
}
|
||||||
// Calculate the envelope
|
// Calculate the envelope
|
||||||
let envelope = match self.envelope {
|
let envelope = match self.envelope {
|
||||||
@@ -461,7 +461,7 @@ impl EmailBuilder {
|
|||||||
if !self.date_issued {
|
if !self.date_issued {
|
||||||
self.message = self
|
self.message = self
|
||||||
.message
|
.message
|
||||||
.header(("Date", Tm::rfc822z(&now()).to_string().as_ref()));
|
.header(("Date", Tm::rfc822z(&now()).to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.message = self.message.header(("MIME-Version", "1.0"));
|
self.message = self.message.header(("MIME-Version", "1.0"));
|
||||||
|
|||||||
Reference in New Issue
Block a user