Async Support

Current Status

The Mailin library was intended to be used by both sync and async servers.

However, as Rust async became more mature it became clear that the current design of Mailin does not support async. I have some ideas to change this but it is a large refactor for something I don't consider to be that important.

Is Async Needed?

If you do not intend to compete with Gmail, synchonous I/O is good enough for SMTP. The spec allows 60 seconds to respond to an SMTP connection -- an overloaded server can put incoming connections onto a queue (this is what mailin-embedded does).

To do a quick calculation of the capacity, we can assume that Mailin supports 1 incoming message per thread per second. The default development setup uses just 4 threads, which gives 4 messages per second.

A large setup could use 100 threads giving 100 messages per second -- 360,000 messages per hour.

Alternatives

For a similar library to Mailin, I recommend looking at smtpbis. It has a nice design and supports async.

For a more complete email server, which also supports async, I recommend looking at samotop. Samotop also supports adding closures so that it is possible to write custom smtp handlers.

Edited by Saul Hazledine