January 2019
Intermediate to advanced
520 pages
14h 32m
English
To write a mailer microservice, we need two dependencies: the nickel crate and the lettre crate. The first is a framework inspired by the Express framework for Node.js. The second implements the SMTP protocol and lets us interact with a mail server such as Postfix. Add these dependencies to Cargo.toml:
failure = "0.1"lettre = { git = "https://github.com/lettre/lettre" }lettre_email = { git = "https://github.com/lettre/lettre" }nickel = "0.10"
For the lettre crate, we're using version 0.9.0 from GitHub, because it's not available on crates.io at the time of writing. We need to import some types from these crates:
use lettre::{ClientSecurity, SendableEmail, EmailAddress, Envelope, SmtpClient, SmtpTransport, Transport}; ...Read now
Unlock full access