Micro service in Rust to send e-mail using SMTP relay.
curl -v localhost:3000/send -d \
'{ "from": "[email protected]", "to": "[email protected]", "subject": "Hello", "plain": "Some message" }'
use gethostname::gethostname;
use rand::Rng;
use std::process;
use std::time::SystemTime;
fn message_id(&self) -> anyhow::Result<String> {
let t = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)?;
let mut rng = rand::thread_rng();
let r: u32 = rng.gen();
Ok(format!(
"<{}.{}.{}@{}>",
t.as_nanos(),
process::id(),
r,
gethostname().into_string().unwrap()
))
}
docker pull ectobit/budgie:buildcache