Centralized the From and Reply-To headers in Microwaveprop.Mailer.apply_defaults/1 so UserNotifier and EditNotifier can't drift. Drops the EMAIL_FROM env var override — both values are hardcoded now.
20 lines
523 B
Elixir
20 lines
523 B
Elixir
defmodule Microwaveprop.Mailer do
|
|
@moduledoc false
|
|
use Swoosh.Mailer, otp_app: :microwaveprop
|
|
|
|
import Swoosh.Email
|
|
|
|
@from {"NTMS Propagation", "prop@w5isp.com"}
|
|
@reply_to "graham@mcintire.me"
|
|
|
|
@doc """
|
|
Apply the site-wide `From:` and `Reply-To:` headers to an outgoing email.
|
|
Centralized here so `UserNotifier` and `EditNotifier` can't drift.
|
|
"""
|
|
@spec apply_defaults(Swoosh.Email.t()) :: Swoosh.Email.t()
|
|
def apply_defaults(email) do
|
|
email
|
|
|> from(@from)
|
|
|> reply_to(@reply_to)
|
|
end
|
|
end
|