diff --git a/README.md b/README.md index ab23b5f..efd76eb 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ lettre = "0.6" ## Testing -The tests require an open mail server listening locally on port 25. +The tests require an open mail server listening locally on port 25 and the `sendmail` command. ## License diff --git a/src/email/mod.rs b/src/email/mod.rs index b8d0652..2af08d2 100644 --- a/src/email/mod.rs +++ b/src/email/mod.rs @@ -267,7 +267,7 @@ pub struct EmailBuilder { } /// Simple email enveloppe representation -#[derive(PartialEq,Eq,Clone,Debug)] +#[derive(PartialEq,Eq,Clone,Debug,Default)] pub struct Envelope { /// The envelope recipients' addresses to: Vec, @@ -622,7 +622,7 @@ impl EmailBuilder { // If there are multiple addresses in "From", the "Sender" is required. if self.from_header.len() >= 2 && self.sender_header.is_none() { // So, we must find something to put as Sender. - for possible_sender in self.from_header.iter() { + for possible_sender in &self.from_header { // Only a mailbox can be used as sender, not Address::Group. if let &Address::Mailbox(ref mbx) = possible_sender { self.sender_header = Some(mbx.clone()); diff --git a/src/transport/sendmail/error.rs b/src/transport/sendmail/error.rs index 5db1cf7..d3dab39 100644 --- a/src/transport/sendmail/error.rs +++ b/src/transport/sendmail/error.rs @@ -50,5 +50,5 @@ impl From<&'static str> for Error { } } -/// SendMail result type +/// sendmail result type pub type SendmailResult = Result<(), Error>; diff --git a/src/transport/smtp/client/mod.rs b/src/transport/smtp/client/mod.rs index 5cc4970..64f1cf1 100644 --- a/src/transport/smtp/client/mod.rs +++ b/src/transport/smtp/client/mod.rs @@ -135,7 +135,7 @@ impl Client { /// Sends a MAIL command pub fn mail(&mut self, address: &str, options: Option<&str>) -> SmtpResult { match options { - Some(ref options) => self.command(&format!("MAIL FROM:<{}> {}", address, options)), + Some(options) => self.command(&format!("MAIL FROM:<{}> {}", address, options)), None => self.command(&format!("MAIL FROM:<{}>", address)), } } @@ -163,7 +163,7 @@ impl Client { /// Sends a HELP command pub fn help(&mut self, argument: Option<&str>) -> SmtpResult { match argument { - Some(ref argument) => self.command(&format!("HELP {}", argument)), + Some(argument) => self.command(&format!("HELP {}", argument)), None => self.command("HELP"), } }