// auth mailer #![allow(non_upper_case_globals)] use include_dir::{include_dir, Dir}; use rustyrails::{ app::AppContext, mailer::{Args, Mailer}, Result, }; use serde_json::json; static welcome: Dir<'_> = include_dir!("src/mailers/auth/welcome"); // #[derive(Mailer)] // -- disabled for faster build speed. it works. but lets // move on for now. #[allow(clippy::module_name_repetitions)] pub struct AuthMailer {} impl Mailer for AuthMailer {} impl AuthMailer { /// Sending welcome email the the given user /// /// # Errors /// /// When email sending is failed pub async fn send_welcome(ctx: &AppContext, _user_id: &str) -> Result<()> { Self::mail_template( ctx, &welcome, Args { to: "foo@example.com".to_string(), locals: json!({ "name": "joe" }), ..Default::default() }, ) .await?; Ok(()) } }