Struct lettre::smtp::SmtpClient
source · pub struct SmtpClient { /* private fields */ }
Expand description
Contains client configuration
Implementations
sourceimpl SmtpClient
impl SmtpClient
Builder for the SMTP SmtpTransport
sourcepub fn new<A: ToSocketAddrs>(
addr: A,
security: ClientSecurity
) -> Result<SmtpClient, Error>
pub fn new<A: ToSocketAddrs>(
addr: A,
security: ClientSecurity
) -> Result<SmtpClient, Error>
Creates a new SMTP client
Defaults are:
- No connection reuse
- No authentication
- No SMTPUTF8 support
- A 60 seconds timeout for smtp commands
sourcepub fn new_simple(domain: &str) -> Result<SmtpClient, Error>
pub fn new_simple(domain: &str) -> Result<SmtpClient, Error>
Simple and secure transport, should be used when possible. Creates an encrypted transport over submissions port, using the provided domain to validate TLS certificates.
sourcepub fn new_unencrypted_localhost() -> Result<SmtpClient, Error>
pub fn new_unencrypted_localhost() -> Result<SmtpClient, Error>
Creates a new local SMTP client to port 25
sourcepub fn smtp_utf8(self, enabled: bool) -> SmtpClient
pub fn smtp_utf8(self, enabled: bool) -> SmtpClient
Enable SMTPUTF8 if the server supports it
sourcepub fn hello_name(self, name: ClientId) -> SmtpClient
pub fn hello_name(self, name: ClientId) -> SmtpClient
Set the name used during EHLO
sourcepub fn connection_reuse(
self,
parameters: ConnectionReuseParameters
) -> SmtpClient
pub fn connection_reuse(
self,
parameters: ConnectionReuseParameters
) -> SmtpClient
Enable connection reuse
sourcepub fn credentials<S: Into<Credentials>>(self, credentials: S) -> SmtpClient
pub fn credentials<S: Into<Credentials>>(self, credentials: S) -> SmtpClient
Set the client credentials
sourcepub fn authentication_mechanism(self, mechanism: Mechanism) -> SmtpClient
pub fn authentication_mechanism(self, mechanism: Mechanism) -> SmtpClient
Set the authentication mechanism to use
sourcepub fn timeout(self, timeout: Option<Duration>) -> SmtpClient
pub fn timeout(self, timeout: Option<Duration>) -> SmtpClient
Set the timeout duration
sourcepub fn transport(self) -> SmtpTransport
pub fn transport(self) -> SmtpTransport
Build the SMTP client
It does not connect to the server, but only creates the SmtpTransport
Auto Trait Implementations
impl RefUnwindSafe for SmtpClient
impl Send for SmtpClient
impl Sync for SmtpClient
impl Unpin for SmtpClient
impl UnwindSafe for SmtpClient
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more