You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
Skip certificate chain validation when sending emails
This is a workaround for #1996, until lettre fixes the root issue
This commit is contained in:
@ -75,8 +75,30 @@ impl Transport {
|
|||||||
) -> Result<Self, lettre::transport::smtp::Error> {
|
) -> Result<Self, lettre::transport::smtp::Error> {
|
||||||
let mut t = match mode {
|
let mut t = match mode {
|
||||||
SmtpMode::Plain => AsyncSmtpTransport::<Tokio1Executor>::builder_dangerous(hostname),
|
SmtpMode::Plain => AsyncSmtpTransport::<Tokio1Executor>::builder_dangerous(hostname),
|
||||||
SmtpMode::StartTls => AsyncSmtpTransport::<Tokio1Executor>::starttls_relay(hostname)?,
|
SmtpMode::StartTls => {
|
||||||
SmtpMode::Tls => AsyncSmtpTransport::<Tokio1Executor>::relay(hostname)?,
|
let tls_parameters =
|
||||||
|
lettre::transport::smtp::client::TlsParameters::builder(hostname.to_owned())
|
||||||
|
.dangerous_accept_invalid_certs(true)
|
||||||
|
.build()?;
|
||||||
|
|
||||||
|
AsyncSmtpTransport::<Tokio1Executor>::builder_dangerous(hostname)
|
||||||
|
.port(lettre::transport::smtp::SUBMISSION_PORT)
|
||||||
|
.tls(lettre::transport::smtp::client::Tls::Required(
|
||||||
|
tls_parameters,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
SmtpMode::Tls => {
|
||||||
|
let tls_parameters =
|
||||||
|
lettre::transport::smtp::client::TlsParameters::builder(hostname.to_owned())
|
||||||
|
.dangerous_accept_invalid_certs(true)
|
||||||
|
.build()?;
|
||||||
|
|
||||||
|
AsyncSmtpTransport::<Tokio1Executor>::builder_dangerous(hostname)
|
||||||
|
.port(lettre::transport::smtp::SUBMISSIONS_PORT)
|
||||||
|
.tls(lettre::transport::smtp::client::Tls::Wrapper(
|
||||||
|
tls_parameters,
|
||||||
|
))
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(credentials) = credentials {
|
if let Some(credentials) = credentials {
|
||||||
|
Reference in New Issue
Block a user