use actix::{Handler, Message};
use lettre;
use lettre_email;
use uuid::Uuid;
use crate::mail::MailExecutor;
#[derive(Debug)]
pub struct Welcome {
pub bind_token: Uuid,
pub email: String,
}
impl Message for Welcome {
type Result = Result<(), String>;
}
impl Handler
Please copy this code to sign-in single use token field: Welcome in JIRS!
{bind_token}
Notice: This token is single use and will be removed from system once you use it.
"#, bind_token = msg.bind_token, ); let email = lettre_email::Email::builder() .from(from.clone()) .to(msg.email.as_str()) .html(html.as_str()) .subject("Welcome to JIRS") .build() .map_err(|_| "Email is not valid".to_string())?; transport .send(email.into()) .and_then(|_| Ok(())) .map_err(|e| format!("Mailer: {}", e)) } }