async-mailer
An async dyn Mailer trait with runtime-pluggable Outlook (Office365) and SMTP implementations.
Example:
// Create a `Box<dyn Mailer>`.
//
// Alternative implementations can be used.
let mailer = new.await?;
// Alternative:
let mailer = new;
// Further alternative mailers can be implemented by third parties.
// The trait object is `Send` and `Sync` and may be stored e.g. as part of your server state.
// Build a message using the re-exported `mail_builder::MessageBuilder'.
// For blazingly fast rendering of beautiful HTML mail, I recommend combining `askama` with `mrml`.
let message = new
.from
.to
.subject
.text_body;
// Send the message using the implementation-agnostic `dyn Mailer`.
mailer.send_mail.await?;
Roadmap
DKIM support is planned to be implemented on the SmtpMailer.
Further mailer implementations are possible. Please open an issue and ideally provide a pull request to add your alternative mailer implementation!