mirror of https://github.com/LemmyNet/lemmy.git
Change name to tls_type, make a string
parent
56642efeda
commit
66e38ff793
|
@ -76,8 +76,8 @@
|
|||
smtp_password: "string"
|
||||
# Address to send emails from, eg noreply@your-instance.com
|
||||
smtp_from_address: "noreply@example.com"
|
||||
# Whether or not smtp connections should use tls. Can be missing (IE None), tls, or starttls
|
||||
use_tls: "string"
|
||||
# Whether or not smtp connections should use tls. Can be none, tls, or starttls
|
||||
tls_type: "none"
|
||||
}
|
||||
# Parameters for automatic configuration of new instance (only used at first start)
|
||||
setup: {
|
||||
|
|
|
@ -77,16 +77,10 @@ pub fn send_email(
|
|||
// Set the TLS
|
||||
let builder_dangerous = SmtpTransport::builder_dangerous(smtp_server).port(smtp_port);
|
||||
|
||||
let mut builder = if let Some(tls_type) = email_config.use_tls {
|
||||
if tls_type == "starttls" {
|
||||
SmtpTransport::starttls_relay(smtp_server)?
|
||||
} else if tls_type == "tls" {
|
||||
SmtpTransport::relay(smtp_server)?
|
||||
} else {
|
||||
builder_dangerous
|
||||
}
|
||||
} else {
|
||||
builder_dangerous
|
||||
let mut builder = match email_config.tls_type.as_str() {
|
||||
"starttls" => SmtpTransport::starttls_relay(smtp_server)?,
|
||||
"tls" => SmtpTransport::relay(smtp_server)?,
|
||||
_ => builder_dangerous,
|
||||
};
|
||||
|
||||
// Set the creds if they exist
|
||||
|
|
|
@ -101,9 +101,10 @@ pub struct EmailConfig {
|
|||
#[doku(example = "noreply@example.com")]
|
||||
/// Address to send emails from, eg "noreply@your-instance.com"
|
||||
pub smtp_from_address: String,
|
||||
/// Whether or not smtp connections should use tls. Can be missing (IE None), tls, or starttls
|
||||
#[default(None)]
|
||||
pub use_tls: Option<String>,
|
||||
/// Whether or not smtp connections should use tls. Can be none, tls, or starttls
|
||||
#[default("none")]
|
||||
#[doku(example = "none")]
|
||||
pub tls_type: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
|
||||
|
|
Loading…
Reference in New Issue