Compare commits

..

2 Commits

Author SHA1 Message Date
Alexis Mousset
a1bf0170db Version 0.2.0 2015-10-06 18:42:35 +02:00
Alexis Mousset
5bedba4b24 Use Tm::rfc822z to support local timezones (workaround for time crate incomplete feature) 2015-10-06 18:42:23 +02:00
3 changed files with 5 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
[package] [package]
name = "smtp" name = "smtp"
version = "0.1.2" version = "0.2.0"
description = "Simple SMTP client" description = "Simple SMTP client"
readme = "README.md" readme = "README.md"
documentation = "http://amousset.me/rust-smtp/smtp/" documentation = "http://amousset.me/rust-smtp/smtp/"

View File

@@ -11,7 +11,7 @@ To use this library, add the following to your `Cargo.toml`:
```toml ```toml
[dependencies] [dependencies]
smtp = "0.1" smtp = "0.2"
``` ```
License License

View File

@@ -166,7 +166,7 @@ impl EmailBuilder {
/// Adds a `Date` header with the given date /// Adds a `Date` header with the given date
pub fn date(mut self, date: &Tm) -> EmailBuilder { pub fn date(mut self, date: &Tm) -> EmailBuilder {
self.insert_header(("Date", Tm::rfc822(date).to_string().as_ref())); self.insert_header(("Date", Tm::rfc822z(date).to_string().as_ref()));
self.date_issued = true; self.date_issued = true;
self self
} }
@@ -174,7 +174,7 @@ impl EmailBuilder {
/// Build the Email /// Build the Email
pub fn build(mut self) -> Email { pub fn build(mut self) -> Email {
if !self.date_issued { if !self.date_issued {
self.insert_header(("Date", Tm::rfc822(&now()).to_string().as_ref())); self.insert_header(("Date", Tm::rfc822z(&now()).to_string().as_ref()));
} }
self.content.message.update_headers(); self.content.message.update_headers();
self.content self.content
@@ -318,7 +318,7 @@ mod test {
assert_eq!( assert_eq!(
format!("{}", email), format!("{}", email),
format!("Message-ID: <{}@rust-smtp>\r\nTo: <user@localhost>\r\nFrom: <user@localhost>\r\nCc: \"Alias\" <cc@localhost>\r\nReply-To: <reply@localhost>\r\nSender: <sender@localhost>\r\nDate: {}\r\nSubject: Hello\r\nX-test: value\r\n\r\nHello World!\r\n", format!("Message-ID: <{}@rust-smtp>\r\nTo: <user@localhost>\r\nFrom: <user@localhost>\r\nCc: \"Alias\" <cc@localhost>\r\nReply-To: <reply@localhost>\r\nSender: <sender@localhost>\r\nDate: {}\r\nSubject: Hello\r\nX-test: value\r\n\r\nHello World!\r\n",
email.message_id().unwrap(), date_now.rfc822()) email.message_id().unwrap(), date_now.rfc822z())
); );
} }