defmodule MvWeb.Emails.JoinAlreadyMemberEmail do @moduledoc """ Sends an email when someone submits the join form with an address that is already a member. Used for anti-enumeration: the UI shows the same success message; only the email informs the recipient. Uses the unified email layout. """ use Gettext, backend: MvWeb.Gettext, otp_app: :mv alias MvWeb.Emails.JoinEmail @doc """ Sends the "already a member" notice to the given address. Returns `{:ok, email}` on success, `{:error, reason}` on delivery failure. """ def send(email_address) when is_binary(email_address) do subject = gettext("Membership application – already a member") JoinEmail.deliver(email_address, "join_already_member.html", subject) end end