#mail-server #smtp-server #server #smtp

mailin-embedded

An SMTP server that can be embedded in other programs

14 releases (7 breaking)

0.8.2 Feb 10, 2024
0.8.1 May 20, 2023
0.8.0 Apr 13, 2023
0.7.1 Jun 6, 2022
0.2.1 Dec 28, 2018

#45 in Email

Download history 54/week @ 2023-12-17 77/week @ 2023-12-24 59/week @ 2023-12-31 80/week @ 2024-01-07 27/week @ 2024-01-14 22/week @ 2024-01-21 56/week @ 2024-01-28 43/week @ 2024-02-04 90/week @ 2024-02-11 108/week @ 2024-02-18 137/week @ 2024-02-25 104/week @ 2024-03-03 100/week @ 2024-03-10 59/week @ 2024-03-17 43/week @ 2024-03-24 295/week @ 2024-03-31

507 downloads per month
Used in 3 crates

MIT/Apache

86KB
2K SLoC

A SMTP server that can be embedded into another program

This library provides a simple embeddable SMTP server. The server uses blocking IO and a threadpool.

Examples

use mailin_embedded::{Server, SslConfig, Handler};

#[derive(Clone)]
struct MyHandler {}
impl Handler for MyHandler{}

let handler = MyHandler {};
let mut server = Server::new(handler);

server.with_name("example.com")
   .with_ssl(SslConfig::None)?
   .with_addr("127.0.0.1:25")?;
server.serve_forever();

SSL

The mailin-embedded library requires an SSL implementation. The SSL implementation is selected with a feature:

Using RustTLS (the default and recommended, so far no compatibility problems):

$ cargo build

Using OpenSSL (with Mozilla modern):

$ cargo build --features "ossl"

The SSL configuration for both of these libraries is quite strict and might not work with some older Email servers. However, until now, I have only seen problems with spammers and no problems with real email servers.

Using in Cargo.toml

mailin-embedded = "^0"

Dependencies

~1–12MB
~122K SLoC