Struct mailin::Session

source ·
pub struct Session<H: Handler> { /* private fields */ }
Expand description

A single smtp session connected to a single client

Implementations

Get a greeting to send to the client

STARTTLS active

Process a line sent by the client.

The parser assumes that the line does not contain the \r\n line ending. Returns a response that should be written back to the client.

Examples
use mailin::{Session, SessionBuilder, Handler, Action};

let response = session.process(b"HELO example.com");

// Check the response
assert_eq!(response.is_error, false);
assert_eq!(response.action, Action::Reply);

// Write the response
let mut msg = Vec::new();
response.write_to(&mut msg);
assert_eq!(&msg, b"250 OK\r\n");

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.