Merge branch 'main' of ssh://gitea.apps.sustainabledelivery.com:3022/mostalive/firehose

This commit is contained in:
Firehose Bot 2026-05-08 11:07:13 +01:00
commit 987e567683
2 changed files with 18 additions and 1 deletions

View File

@ -118,4 +118,15 @@ if config_env() == :prod do
# config :swoosh, :api_client, Swoosh.ApiClient.Req # config :swoosh, :api_client, Swoosh.ApiClient.Req
# #
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details. # 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 end

View File

@ -11,12 +11,18 @@ defmodule Firehose.Accounts.UserNotifier do
alias Firehose.Accounts.User alias Firehose.Accounts.User
alias Firehose.Mailer 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. # Delivers the email using the application mailer.
defp deliver(recipient, subject, body) do defp deliver(recipient, subject, body) do
email = email =
new() new()
|> to(recipient) |> to(recipient)
|> from({"Firehose", "contact@example.com"}) |> from(sender())
|> subject(subject) |> subject(subject)
|> text_body(body) |> text_body(body)