mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-05-28 22:43:56 +00:00
Add option to set name during HELO in email settings
This commit is contained in:
parent
d4357eb55a
commit
596c9b8691
4 changed files with 28 additions and 2 deletions
|
@ -394,7 +394,9 @@ make_config! {
|
|||
/// Json form auth mechanism |> Defaults for ssl is "Plain" and "Login" and nothing for non-ssl connections. Possible values: ["Plain", "Login", "Xoauth2"]
|
||||
smtp_auth_mechanism: String, true, option;
|
||||
/// SMTP connection timeout |> Number of seconds when to stop trying to connect to the SMTP server
|
||||
smtp_timeout: u64, true, def, 15;
|
||||
smtp_timeout: u64, true, def, 15;
|
||||
/// Server name sent during HELO |> By default this value should be is on the machine's hostname, but might need to be changed in case it trips some anti-spam filters
|
||||
helo_name: String, true, option;
|
||||
},
|
||||
|
||||
/// Email 2FA Settings
|
||||
|
|
|
@ -2,6 +2,7 @@ use std::str::FromStr;
|
|||
|
||||
use lettre::message::{header, Mailbox, Message, MultiPart, SinglePart};
|
||||
use lettre::transport::smtp::authentication::{Credentials, Mechanism as SmtpAuthMechanism};
|
||||
use lettre::transport::smtp::extension::ClientId;
|
||||
use lettre::{Address, SmtpTransport, Tls, TlsParameters, Transport};
|
||||
|
||||
use native_tls::{Protocol, TlsConnector};
|
||||
|
@ -42,6 +43,11 @@ fn mailer() -> SmtpTransport {
|
|||
_ => smtp_client,
|
||||
};
|
||||
|
||||
let smtp_client = match CONFIG.helo_name() {
|
||||
Some(helo_name) => smtp_client.hello_name(ClientId::new(helo_name)),
|
||||
None => smtp_client,
|
||||
};
|
||||
|
||||
let smtp_client = match CONFIG.smtp_auth_mechanism() {
|
||||
Some(mechanism) => {
|
||||
let correct_mechanism = format!("\"{}\"", crate::util::upcase_first(mechanism.trim_matches('"')));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue