From 40e1f4b01e2f46d4672a1223c8b8f3f991fa3243 Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 2 Nov 2023 21:59:23 +0100 Subject: [PATCH] Add tls_certificate_check.options to system mailer config --- config/runtime.exs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index a6210440..d0734c21 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -1,6 +1,8 @@ import Config require Logger :ok == Application.ensure_started(:logger) +:ok == Application.ensure_started(:ssl_verify_fun) +:ok == Application.ensure_started(:tls_certificate_check) exit_from_exception = fn exception, message -> Logger.error(exception.message) @@ -84,10 +86,18 @@ if config_env() == :prod do relay: host, username: user, password: password, - from_email: from_email, - ssl: ssl? + from_email: from_email ] |> put_if_not_empty.(:port, port) + |> then(fn config -> + if ssl? do + config + |> Keyword.put(:ssl, true) + |> Keyword.put(:sockopts, :tls_certificate_check.options(host)) + else + config + end + end) end config(:keila, Keila.Mailer, config)