normalize email from
This commit is contained in:
+13
-9
@@ -25,7 +25,7 @@ use tracing::{debug, info, warn};
|
||||
|
||||
use crate::{
|
||||
queries,
|
||||
state::{SharedState, SmtpConfig},
|
||||
state::{SharedState, SmtpConfig, SmtpSecurity},
|
||||
};
|
||||
|
||||
const MIN_PASSWORD: usize = 8;
|
||||
@@ -2098,15 +2098,19 @@ async fn send_share_invitation(
|
||||
}
|
||||
|
||||
async fn send_message(smtp: &SmtpConfig, message: Message, label: &str) -> Result<(), AuthError> {
|
||||
let mut builder = if smtp.port == 465 {
|
||||
AsyncSmtpTransport::<Tokio1Executor>::relay(&smtp.host)
|
||||
} else {
|
||||
AsyncSmtpTransport::<Tokio1Executor>::starttls_relay(&smtp.host)
|
||||
let mut builder = match smtp.security {
|
||||
SmtpSecurity::None => AsyncSmtpTransport::<Tokio1Executor>::builder_dangerous(&smtp.host),
|
||||
SmtpSecurity::StartTls => AsyncSmtpTransport::<Tokio1Executor>::starttls_relay(&smtp.host)
|
||||
.map_err(|error| {
|
||||
tracing::error!(error = %error, host = %smtp.host, port = smtp.port, security = ?smtp.security, "invalid SMTP configuration");
|
||||
AuthError::internal("Invalid SMTP configuration.")
|
||||
})?,
|
||||
SmtpSecurity::Tls => AsyncSmtpTransport::<Tokio1Executor>::relay(&smtp.host)
|
||||
.map_err(|error| {
|
||||
tracing::error!(error = %error, host = %smtp.host, port = smtp.port, security = ?smtp.security, "invalid SMTP configuration");
|
||||
AuthError::internal("Invalid SMTP configuration.")
|
||||
})?,
|
||||
}
|
||||
.map_err(|error| {
|
||||
tracing::error!(error = %error, host = %smtp.host, port = smtp.port, "invalid SMTP configuration");
|
||||
AuthError::internal("Invalid SMTP configuration.")
|
||||
})?
|
||||
.port(smtp.port);
|
||||
|
||||
if !smtp.username.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user