Commit c2727247 authored by Szymon Zimnowoda's avatar Szymon Zimnowoda
Browse files

Merge branch 'sz/extend_smtp_conf' into 'dev'

added sender address as env variable

See merge request !414
Showing with 9 additions and 2 deletions
+9 -2
......@@ -165,6 +165,10 @@ pub struct CliOptions {
#[arg(long, default_value = "465", env)]
pub email_smtp_port: u16,
/// SMTP relay server email sender address.
#[arg(long, env)]
pub email_smtp_sender_address: Option<String>,
/// SMTP relay server user (advanced option).
#[arg(long, env)]
pub email_smtp_user: Option<String>,
......@@ -258,6 +262,7 @@ pub mod tests {
email_smtp_port: 465,
email_smtp_user: None,
email_smtp_password: None,
email_smtp_sender_address: None,
owner_key_for_pod: Default::default(),
db_key_for_pod: Secret::new(String::default()),
shared_plugins: Vec::new(),
......
......@@ -14,10 +14,11 @@ pub async fn send_email(email: SendEmail, cli: &CliOptions) -> Result<()> {
&cli.email_smtp_relay,
&cli.email_smtp_user,
&cli.email_smtp_password,
&cli.email_smtp_sender_address,
) {
(Some(relay), Some(user), Some(password)) => {
(Some(relay), Some(user), Some(password), Some(sender_address)) => {
let email = Message::builder()
.from(format!("Memri <{user}>").parse()?)
.from(format!("Memri <{sender_address}>").parse()?)
.to(email.to.parse()?)
.subject(email.subject.to_string())
.body(format!("{}\n{}", email.body, PLUGIN_EMAIL_FOOTER))?;
......
......@@ -46,6 +46,7 @@ pub fn default_cli() -> CliOptions {
email_smtp_port: 465,
email_smtp_user: None,
email_smtp_password: None,
email_smtp_sender_address: None,
owner_key_for_pod: Default::default(),
db_key_for_pod: Secret::new(String::default()),
shared_plugins: Vec::new(),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment