From 9a721191fe858b5badc28a89ec3f85ff1eba2293 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sun, 4 Jan 2026 11:16:12 -0600 Subject: [PATCH] Set default email sender to hi@towerops.net Configure mailer_from in runtime config and update UserNotifier and AlertNotifier to use the configured from address. --- config/runtime.exs | 3 +++ lib/towerops/accounts/user_notifier.ex | 4 +++- lib/towerops/alerts/alert_notifier.ex | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index df56f943..a0696ad9 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -134,4 +134,7 @@ if config_env() == :prod do secret_key_base: secret_key_base config :towerops, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY") + + # Set default sender for all emails + config :towerops, :mailer_from, {"Towerops", "hi@towerops.net"} end diff --git a/lib/towerops/accounts/user_notifier.ex b/lib/towerops/accounts/user_notifier.ex index f5a061ae..6aea21ff 100644 --- a/lib/towerops/accounts/user_notifier.ex +++ b/lib/towerops/accounts/user_notifier.ex @@ -7,10 +7,12 @@ defmodule Towerops.Accounts.UserNotifier do # Delivers the email using the application mailer. defp deliver(recipient, subject, body) do + from_address = Application.get_env(:towerops, :mailer_from, {"Towerops", "hi@towerops.net"}) + email = new() |> to(recipient) - |> from({"Towerops", "contact@example.com"}) + |> from(from_address) |> subject(subject) |> text_body(body) diff --git a/lib/towerops/alerts/alert_notifier.ex b/lib/towerops/alerts/alert_notifier.ex index 5be7cabc..52debb4b 100644 --- a/lib/towerops/alerts/alert_notifier.ex +++ b/lib/towerops/alerts/alert_notifier.ex @@ -90,10 +90,12 @@ defmodule Towerops.Alerts.AlertNotifier do end defp deliver(recipient, subject, body) do + from_address = Application.get_env(:towerops, :mailer_from, {"Towerops", "hi@towerops.net"}) + email = new() |> to(recipient) - |> from({"TowerOps Alerts", "alerts@towerops.example.com"}) + |> from(from_address) |> subject(subject) |> text_body(body)