pub struct SmtpClientBuilder<T: AsRef<str> + PartialEq + Eq + Hash> {
pub timeout: Duration,
pub tls_connector: TlsConnector,
pub tls_hostname: T,
pub tls_implicit: bool,
pub credentials: Option<Credentials<T>>,
pub addr: String,
pub is_lmtp: bool,
pub say_ehlo: bool,
pub local_host: String,
pub local_ip: Option<IpAddr>,
}
Expand description
SMTP client builder
Fields§
§timeout: Duration
§tls_connector: TlsConnector
§tls_hostname: T
§tls_implicit: bool
§credentials: Option<Credentials<T>>
§addr: String
§is_lmtp: bool
§say_ehlo: bool
§local_host: String
§local_ip: Option<IpAddr>
Implementations§
Source§impl<T: AsRef<str> + PartialEq + Eq + Hash> SmtpClientBuilder<T>
impl<T: AsRef<str> + PartialEq + Eq + Hash> SmtpClientBuilder<T>
pub fn new(hostname: T, port: u16) -> Self
Sourcepub fn allow_invalid_certs(self) -> Self
pub fn allow_invalid_certs(self) -> Self
Allow invalid TLS certificates
Sourcepub fn implicit_tls(self, tls_implicit: bool) -> Self
pub fn implicit_tls(self, tls_implicit: bool) -> Self
Start connection in TLS or upgrade with STARTTLS
pub fn say_ehlo(self, say_ehlo: bool) -> Self
Sourcepub fn credentials(self, credentials: impl Into<Credentials<T>>) -> Self
pub fn credentials(self, credentials: impl Into<Credentials<T>>) -> Self
Sets the authentication credentials
Sourcepub fn local_ip(self, local_ip: IpAddr) -> Self
pub fn local_ip(self, local_ip: IpAddr) -> Self
Sets the local IP to use while sending the email.
This is useful if your machine has multiple public IPs assigned and you want to ensure that you are using the intended one. Using an IP with good repudiation is quite important when you want to ensure deliverability.
NOTE: If the IP is not available on that machine, the [connect
] and [connect_plain
] will return and error
Sourcepub async fn connect_plain(&self) -> Result<SmtpClient<TcpStream>>
pub async fn connect_plain(&self) -> Result<SmtpClient<TcpStream>>
Connect over clear text (should not be used)
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SmtpClientBuilder<T>where
T: Freeze,
impl<T> !RefUnwindSafe for SmtpClientBuilder<T>
impl<T> Send for SmtpClientBuilder<T>where
T: Send,
impl<T> Sync for SmtpClientBuilder<T>where
T: Sync,
impl<T> Unpin for SmtpClientBuilder<T>where
T: Unpin,
impl<T> !UnwindSafe for SmtpClientBuilder<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more