Skip to content

Commit

Permalink
Add tls_certificate_check.options to system mailer config
Browse files Browse the repository at this point in the history
  • Loading branch information
wmnnd committed Nov 2, 2023
1 parent 8426887 commit 40e1f4b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 40e1f4b

Please sign in to comment.