fix(emails): use tls_certificate_check to add tls config for mailer

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-12-07 11:42:19 +01:00
parent 7210f86889
commit db385501aa
4 changed files with 7 additions and 17 deletions

View File

@@ -124,14 +124,6 @@ config :mobilizon, Mobilizon.Web.Email.Mailer,
# ssl: false,
# can be `:always` or `:never`
tls: :never,
allowed_tls_versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"],
tls_options: [
verify: :verify_peer,
versions: [:"tlsv1.2", :"tlsv1.3"],
cacerts: :public_key.cacerts_get(),
server_name_indication: ~c"localhost",
depth: 99
],
retries: 1,
# can be `true`
no_mx_lookups: false

View File

@@ -2,6 +2,8 @@
import Config
{:ok, _} = Application.ensure_all_started(:tls_certificate_check)
loglevels = [
:emergency,
:alert,
@@ -72,14 +74,8 @@ config :mobilizon, Mobilizon.Web.Email.Mailer,
username: System.get_env("MOBILIZON_SMTP_USERNAME", nil),
password: System.get_env("MOBILIZON_SMTP_PASSWORD", nil),
tls: System.get_env("MOBILIZON_SMTP_TLS", "if_available"),
allowed_tls_versions: [:"tlsv1.2", :"tlsv1.3"],
tls_options: [
verify: :verify_peer,
versions: [:"tlsv1.2", :"tlsv1.3"],
cacerts: :public_key.cacerts_get(),
server_name_indication: ~c"#{System.get_env("MOBILIZON_SMTP_SERVER", "localhost")}",
depth: 99
],
tls_options:
:tls_certificate_check.options(System.get_env("MOBILIZON_SMTP_SERVER", "localhost")),
ssl: System.get_env("MOBILIZON_SMTP_SSL", "false"),
retries: 1,
no_mx_lookups: false,