From: MichaƂ <30625554+n3oney@users.noreply.github.com> Date: Wed, 21 Jun 2023 17:36:42 +0000 (+0200) Subject: feat: allow overriding smtp_password with the LEMMY_SMTP_PASSWORD env var (#3154) X-Git-Url: http://these/git/%7B%60%24%7BarchiveTodayUrl%7D/%22%7Bauthor_url%7D/static/maint-mode.css?a=commitdiff_plain;h=4cdb9583e9a9a7fe8df4afd429f584fd88a3e0ff;p=lemmy.git feat: allow overriding smtp_password with the LEMMY_SMTP_PASSWORD env var (#3154) Co-authored-by: Dessalines --- diff --git a/crates/utils/src/email.rs b/crates/utils/src/email.rs index eda8309f..62cbe3c5 100644 --- a/crates/utils/src/email.rs +++ b/crates/utils/src/email.rs @@ -78,7 +78,11 @@ pub fn send_email( }; // Set the creds if they exist - if let (Some(username), Some(password)) = (email_config.smtp_login, email_config.smtp_password) { + let smtp_password = std::env::var("LEMMY_SMTP_PASSWORD") + .ok() + .or(email_config.smtp_password); + + if let (Some(username), Some(password)) = (email_config.smtp_login, smtp_password) { builder = builder.credentials(Credentials::new(username, password)); }