Simplify header formatting and fix nightly build (fixes #340)
This commit is contained in:
@@ -131,7 +131,7 @@ impl PartBuilder {
|
||||
|
||||
/// Adds a `ContentType` header with the given MIME type
|
||||
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
|
||||
@@ -303,7 +303,7 @@ impl EmailBuilder {
|
||||
.body(body)
|
||||
.header((
|
||||
"Content-Type",
|
||||
format!("{}", mime::TEXT_PLAIN_UTF_8).as_ref(),
|
||||
mime::TEXT_PLAIN_UTF_8.to_string(),
|
||||
))
|
||||
.build();
|
||||
self.child(text)
|
||||
@@ -315,7 +315,7 @@ impl EmailBuilder {
|
||||
.body(body)
|
||||
.header((
|
||||
"Content-Type",
|
||||
format!("{}", mime::TEXT_HTML_UTF_8).as_ref(),
|
||||
mime::TEXT_HTML_UTF_8.to_string(),
|
||||
))
|
||||
.build();
|
||||
self.child(html)
|
||||
@@ -331,7 +331,7 @@ impl EmailBuilder {
|
||||
.body(body_text)
|
||||
.header((
|
||||
"Content-Type",
|
||||
format!("{}", mime::TEXT_PLAIN_UTF_8).as_ref(),
|
||||
mime::TEXT_PLAIN_UTF_8.to_string(),
|
||||
))
|
||||
.build();
|
||||
|
||||
@@ -339,7 +339,7 @@ impl EmailBuilder {
|
||||
.body(body_html)
|
||||
.header((
|
||||
"Content-Type",
|
||||
format!("{}", mime::TEXT_HTML_UTF_8).as_ref(),
|
||||
mime::TEXT_HTML_UTF_8.to_string(),
|
||||
))
|
||||
.build();
|
||||
|
||||
@@ -379,7 +379,7 @@ impl EmailBuilder {
|
||||
}
|
||||
// Add the sender header, if any.
|
||||
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
|
||||
let envelope = match self.envelope {
|
||||
@@ -471,7 +471,7 @@ impl EmailBuilder {
|
||||
if !self.date_issued {
|
||||
self.message = self
|
||||
.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"));
|
||||
|
||||
Reference in New Issue
Block a user