feat(transport-smtp): get_ehlo and reset in SmtpTransport should not be public
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
|
||||
name = "lettre"
|
||||
version = "0.7.0" # remember to update html_root_url
|
||||
version = "0.8.0" # remember to update html_root_url
|
||||
description = "Email client"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/lettre/"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//! emails have to implement `SendableEmail`.
|
||||
//!
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/lettre/0.7.0")]
|
||||
#![doc(html_root_url = "https://docs.rs/lettre/0.8.0")]
|
||||
#![deny(missing_docs, unsafe_code, unstable_features, warnings)]
|
||||
|
||||
#[cfg(feature = "smtp-transport")]
|
||||
|
||||
@@ -248,11 +248,17 @@ impl Display for RcptParameter {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
||||
use super::{Extension, ServerInfo};
|
||||
use super::{Extension, ServerInfo, ClientId};
|
||||
use smtp::authentication::Mechanism;
|
||||
use smtp::response::{Category, Code, Detail, Response, Severity};
|
||||
use std::collections::HashSet;
|
||||
|
||||
#[test]
|
||||
fn test_clientid_fmt() {
|
||||
assert_eq!(format!("{}", ClientId::new("test".to_string())),
|
||||
"test".to_string());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extension_fmt() {
|
||||
assert_eq!(format!("{}", Extension::EightBitMime),
|
||||
|
||||
@@ -304,7 +304,7 @@ macro_rules! try_smtp (
|
||||
Err(err) => {
|
||||
if !$client.state.panic {
|
||||
$client.state.panic = true;
|
||||
$client.reset();
|
||||
$client.close();
|
||||
}
|
||||
return Err(From::from(err))
|
||||
},
|
||||
@@ -353,7 +353,7 @@ impl<'a> SmtpTransport {
|
||||
}
|
||||
|
||||
/// Gets the EHLO response and updates server information
|
||||
pub fn get_ehlo(&mut self) -> SmtpResult {
|
||||
fn ehlo(&mut self) -> SmtpResult {
|
||||
// Extended Hello
|
||||
let ehlo_response = try_smtp!(
|
||||
self.client.command(EhloCommand::new(
|
||||
@@ -370,15 +370,10 @@ impl<'a> SmtpTransport {
|
||||
Ok(ehlo_response)
|
||||
}
|
||||
|
||||
/// Closes the inner connection
|
||||
pub fn close(&mut self) {
|
||||
self.client.close();
|
||||
}
|
||||
|
||||
/// Reset the client state
|
||||
pub fn reset(&mut self) {
|
||||
pub fn close(&mut self) {
|
||||
// Close the SMTP transaction if needed
|
||||
self.close();
|
||||
self.client.close();
|
||||
|
||||
// Reset the client state
|
||||
self.server_info = None;
|
||||
@@ -396,7 +391,7 @@ impl<'a, T: Read + 'a> EmailTransport<'a, T, SmtpResult> for SmtpTransport {
|
||||
|
||||
// Check if the connection is still available
|
||||
if (self.state.connection_reuse_count > 0) && (!self.client.is_connected()) {
|
||||
self.reset();
|
||||
self.close();
|
||||
}
|
||||
|
||||
if self.state.connection_reuse_count == 0 {
|
||||
@@ -413,7 +408,7 @@ impl<'a, T: Read + 'a> EmailTransport<'a, T, SmtpResult> for SmtpTransport {
|
||||
// Log the connection
|
||||
info!("connection established to {}", self.client_info.server_addr);
|
||||
|
||||
self.get_ehlo()?;
|
||||
self.ehlo()?;
|
||||
|
||||
match (&self.client_info.security.clone(),
|
||||
self.server_info.as_ref()
|
||||
@@ -434,7 +429,7 @@ impl<'a, T: Read + 'a> EmailTransport<'a, T, SmtpResult> for SmtpTransport {
|
||||
debug!("connection encrypted");
|
||||
|
||||
// Send EHLO again
|
||||
self.get_ehlo()?;
|
||||
self.ehlo()?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,9 +525,9 @@ impl<'a, T: Read + 'a> EmailTransport<'a, T, SmtpResult> for SmtpTransport {
|
||||
ConnectionReuseParameters::ReuseLimited(limit)
|
||||
if self.state.connection_reuse_count >= limit =>
|
||||
{
|
||||
self.reset()
|
||||
self.close()
|
||||
}
|
||||
ConnectionReuseParameters::NoReuse => self.reset(),
|
||||
ConnectionReuseParameters::NoReuse => self.close(),
|
||||
_ => (),
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
|
||||
name = "lettre_email"
|
||||
version = "0.7.0" # remember to update html_root_url
|
||||
version = "0.8.0" # remember to update html_root_url
|
||||
description = "Email builder"
|
||||
readme = "README.md"
|
||||
documentation = "https://docs.rs/lettre_email/"
|
||||
@@ -16,11 +16,11 @@ travis-ci = { repository = "lettre/lettre_email" }
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "^0.4"
|
||||
lettre = { version = "^0.7", path = "../lettre", features = ["smtp-transport"] }
|
||||
lettre = { version = "^0.8", path = "../lettre", features = ["smtp-transport"] }
|
||||
|
||||
[dependencies]
|
||||
email = "^0.0"
|
||||
mime = "^0.3"
|
||||
time = "^0.1"
|
||||
uuid = { version = ">=0.4, <0.6", features = ["v4"] }
|
||||
lettre = { version = "^0.7", path = "../lettre", default-features = false }
|
||||
lettre = { version = "^0.8", path = "../lettre", default-features = false }
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
//! See the `EmailBuilder` documentation for a complete list of methods.
|
||||
//!
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/lettre_email/0.7.0")]
|
||||
#![doc(html_root_url = "https://docs.rs/lettre_email/0.8.0")]
|
||||
#![deny(missing_docs, unsafe_code, unstable_features, warnings, missing_debug_implementations)]
|
||||
|
||||
extern crate email as email_format;
|
||||
|
||||
Reference in New Issue
Block a user