new_tokio_smtp/
lib.rs

1//! The new-tokio-smtp crate provides an extendible SMTP (Simple Mail Transfer Protocol)
2//! implementation using tokio.
3//!
4//! This crate provides _only_ SMTP functionality, this means it does neither
5//! provides functionality for creating mails, nor for e.g. retrying sending
6//! a mail if the receiver was temporary not available.
7//!
8//! This crate can be seen from two perspectives:
9//!
10//! 1. a normal API user, mainly bothering with `ConnectionConfig`, `Connection`
11//!    and `Cmd` implementations (in the `command` module)
12//!
13//! 2. a cmd implementation, having to use `Io`, `Socket` etc.
14//!
15//! # Features
16//!
17//! ## `send_mail`
18//!
19//! While still not handling the creation/encoding of mails if this feature is
20//! enabled a `send_mail` command is added `Connection` which combines the steps
21//! of sending the `MAIL` command, the `RCPT` command and the `DATA` command.
22//!
23//! ## `mock-support`, `mock-impl`
24//!
25//! Extend the `Socket` abstraction to include a mock socket additional to `Tcp`, `TcpTls`.
26//! Also provides a mock socket implementation for simply testing commands. Custom implementations
27//! can be provided too if needed for testing
28//!
29
30// I use `{ ...; let fut = ...long multi line; fut }` a lot for better readability.
31// it also makes it so much easier to wrap the return value into a `dbg!`, `Box::new` and similar.
32#![allow(clippy::let_and_return)]
33
34#[macro_use]
35extern crate futures;
36extern crate base64;
37extern crate bytes;
38extern crate hostname;
39extern crate native_tls;
40#[cfg(feature = "mock-impl")]
41extern crate rand;
42extern crate tokio;
43extern crate tokio_tls;
44#[cfg(feature = "send-mail")]
45extern crate vec1;
46// order of modules is also "order" in dependency-tree
47// i.e. module should only import from modules hither
48// up in the list
49mod ascii;
50mod data_types;
51pub mod future_ext;
52#[macro_use]
53mod common;
54pub mod chain;
55pub mod command;
56mod connect;
57mod connection;
58pub mod error;
59pub mod io;
60#[cfg(feature = "mock-impl")]
61pub mod mock;
62pub mod response;
63#[cfg(feature = "send-mail")]
64pub mod send_mail;
65
66pub use self::common::*;
67pub use self::connect::*;
68pub use self::connection::*;
69pub use self::data_types::*;
70pub use self::io::Io;
71pub use self::response::Response;