Struct mailin_embedded::Server

source ·
pub struct Server<H>
where H: Handler + Clone + Send,
{ /* private fields */ }
Expand description

Server is used to configure and start the SMTP server

Implementations§

source§

impl<H> Server<H>
where H: Handler + Clone + Send,

source

pub fn new(handler: H) -> Self

Create a new server with the given Handler

source

pub fn with_name<T>(&mut self, name: T) -> &mut Self
where T: Into<String>,

Give the server a name

source

pub fn with_ssl(&mut self, ssl_config: SslConfig) -> Result<&mut Self, Error>

Set the SSL configuration of the server

source

pub fn with_num_threads(&mut self, num_threads: u32) -> &mut Self

Set the size of the threadpool which is equal to the maximum number of concurrent SMTP sessions.

source

pub fn with_auth(&mut self, auth: AuthMechanism) -> &mut Self

Add an authentication mechanism that will supported by the server

source

pub fn with_tcp_listener(&mut self, listener: TcpListener) -> &mut Self

Set a tcp listener from an already open socket

source

pub fn with_addr<A: ToSocketAddrs>( &mut self, addr: A ) -> Result<&mut Self, Error>

Add ip addresses and ports to listen on. Returns an error if the given socket addresses are not valid.

server.with_addr("127.0.0.1:25")?;
source

pub fn serve(self) -> Result<(), Error>

Start the SMTP server and run forever

Auto Trait Implementations§

§

impl<H> !RefUnwindSafe for Server<H>

§

impl<H> Send for Server<H>

§

impl<H> Sync for Server<H>
where H: Sync,

§

impl<H> Unpin for Server<H>
where H: Unpin,

§

impl<H> !UnwindSafe for Server<H>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.