pub struct Session<H: Handler> { /* private fields */ }
Expand description
A single smtp session connected to a single client
Implementations
sourceimpl<H: Handler> Session<H>
impl<H: Handler> Session<H>
sourcepub fn tls_active(&mut self)
pub fn tls_active(&mut self)
STARTTLS active
sourcepub fn process(&mut self, line: &[u8]) -> Response
pub fn process(&mut self, line: &[u8]) -> Response
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
impl<H> !RefUnwindSafe for Session<H>
impl<H> !Send for Session<H>
impl<H> !Sync for Session<H>
impl<H> Unpin for Session<H>where
H: Unpin,
impl<H> !UnwindSafe for Session<H>
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