geforkt von mirrored/vaultwarden
Added SMTP_FROM_NAME
Dieser Commit ist enthalten in:
Ursprung
2fe919cc5e
Commit
0e4a746eeb
3 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
|
@ -86,6 +86,7 @@
|
||||||
## Note: if SMTP_USERNAME is specified, SMTP_PASSWORD is mandatory
|
## Note: if SMTP_USERNAME is specified, SMTP_PASSWORD is mandatory
|
||||||
# SMTP_HOST=smtp.domain.tld
|
# SMTP_HOST=smtp.domain.tld
|
||||||
# SMTP_FROM=bitwarden-rs@domain.tld
|
# SMTP_FROM=bitwarden-rs@domain.tld
|
||||||
|
# SMTP_FROM_NAME=Bitwarden_RS
|
||||||
# SMTP_PORT=587
|
# SMTP_PORT=587
|
||||||
# SMTP_SSL=true
|
# SMTP_SSL=true
|
||||||
# SMTP_USERNAME=username
|
# SMTP_USERNAME=username
|
||||||
|
|
|
@ -125,7 +125,7 @@ pub fn send_invite_confirmed(address: &str, org_name: &str, config: &MailConfig)
|
||||||
fn send_email(address: &str, subject: &str, body: &str, config: &MailConfig) -> EmptyResult {
|
fn send_email(address: &str, subject: &str, body: &str, config: &MailConfig) -> EmptyResult {
|
||||||
let email = EmailBuilder::new()
|
let email = EmailBuilder::new()
|
||||||
.to(address)
|
.to(address)
|
||||||
.from((config.smtp_from.clone(), "Bitwarden-rs"))
|
.from((config.smtp_from.clone(), config.smtp_from_name.clone()))
|
||||||
.subject(subject)
|
.subject(subject)
|
||||||
.header(("Content-Type", "text/html"))
|
.header(("Content-Type", "text/html"))
|
||||||
.body(body)
|
.body(body)
|
||||||
|
|
|
@ -244,6 +244,7 @@ pub struct MailConfig {
|
||||||
smtp_port: u16,
|
smtp_port: u16,
|
||||||
smtp_ssl: bool,
|
smtp_ssl: bool,
|
||||||
smtp_from: String,
|
smtp_from: String,
|
||||||
|
smtp_from_name: String,
|
||||||
smtp_username: Option<String>,
|
smtp_username: Option<String>,
|
||||||
smtp_password: Option<String>,
|
smtp_password: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -263,6 +264,8 @@ impl MailConfig {
|
||||||
exit(1);
|
exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let smtp_from_name = get_env_or("SMTP_FROM_NAME", "Bitwarden_RS".into());
|
||||||
|
|
||||||
let smtp_ssl = get_env_or("SMTP_SSL", true);
|
let smtp_ssl = get_env_or("SMTP_SSL", true);
|
||||||
let smtp_port = get_env("SMTP_PORT").unwrap_or_else(|| if smtp_ssl { 587u16 } else { 25u16 });
|
let smtp_port = get_env("SMTP_PORT").unwrap_or_else(|| if smtp_ssl { 587u16 } else { 25u16 });
|
||||||
|
|
||||||
|
@ -281,6 +284,7 @@ impl MailConfig {
|
||||||
smtp_port,
|
smtp_port,
|
||||||
smtp_ssl,
|
smtp_ssl,
|
||||||
smtp_from,
|
smtp_from,
|
||||||
|
smtp_from_name,
|
||||||
smtp_username,
|
smtp_username,
|
||||||
smtp_password,
|
smtp_password,
|
||||||
})
|
})
|
||||||
|
|
Laden …
In neuem Issue referenzieren