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

mailin-embedded

An SMTP server that can be embedded in other programs

15 unstable releases

0.8.3 Aug 31, 2024
0.8.2 Feb 10, 2024
0.8.1 May 20, 2023
0.7.1 Jun 6, 2022
0.2.1 Dec 28, 2018

#103 in Email

Download history 72/week @ 2024-07-18 142/week @ 2024-07-25 154/week @ 2024-08-01 126/week @ 2024-08-08 87/week @ 2024-08-15 68/week @ 2024-08-22 274/week @ 2024-08-29 89/week @ 2024-09-05 84/week @ 2024-09-12 71/week @ 2024-09-19 96/week @ 2024-09-26 83/week @ 2024-10-03 44/week @ 2024-10-10 54/week @ 2024-10-17 51/week @ 2024-10-24 20/week @ 2024-10-31

180 downloads per month
Used in 3 crates

MIT/Apache

88KB
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.1–9.5MB
~110K SLoC