Merge branch 'main' of ssh://gitea.apps.sustainabledelivery.com:3022/mostalive/firehose
This commit is contained in:
commit
987e567683
@ -118,4 +118,15 @@ if config_env() == :prod do
|
||||
# config :swoosh, :api_client, Swoosh.ApiClient.Req
|
||||
#
|
||||
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
|
||||
|
||||
config :firehose, Firehose.Mailer,
|
||||
adapter: Swoosh.Adapters.SMTP,
|
||||
server: System.get_env("SMTP_HOST"),
|
||||
port: String.to_integer(System.get_env("SMTP_PORT") || "587"),
|
||||
username: System.get_env("SMTP_USERNAME"),
|
||||
password: System.get_env("SMTP_PASSWORD"),
|
||||
ssl: System.get_env("SMTP_SSL") in ~w(true 1),
|
||||
tls: System.get_env("SMTP_TLS") in ~w(true 1) || System.get_env("SMTP_SSL") not in ~w(true 1),
|
||||
retries: 2,
|
||||
no_dns_lookup: true
|
||||
end
|
||||
|
||||
@ -11,12 +11,18 @@ defmodule Firehose.Accounts.UserNotifier do
|
||||
alias Firehose.Accounts.User
|
||||
alias Firehose.Mailer
|
||||
|
||||
defp sender do
|
||||
name = System.get_env("SENDER_NAME") || "Firehose"
|
||||
email = System.get_env("SMTP_FROM_EMAIL") || "contact@example.com"
|
||||
{name, email}
|
||||
end
|
||||
|
||||
# Delivers the email using the application mailer.
|
||||
defp deliver(recipient, subject, body) do
|
||||
email =
|
||||
new()
|
||||
|> to(recipient)
|
||||
|> from({"Firehose", "contact@example.com"})
|
||||
|> from(sender())
|
||||
|> subject(subject)
|
||||
|> text_body(body)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user