fix: join confirmation mail configuration
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
a7481f6ab1
commit
40a4461d23
12 changed files with 167 additions and 28 deletions
|
|
@ -15,11 +15,11 @@ defmodule MvWeb.Emails.JoinConfirmationEmail do
|
|||
@doc """
|
||||
Sends the join confirmation email to the given address with the confirmation link.
|
||||
|
||||
Uses the same SMTP configuration as the test mail (Settings or boot ENV) via
|
||||
`Mailer.deliver/2` with `Mailer.smtp_config/0` for consistency.
|
||||
|
||||
Called from the domain after a JoinRequest is created (submit flow).
|
||||
Returns `{:ok, email}` on success, `{:error, reason}` on delivery failure.
|
||||
Callers should log errors and may still return success for the overall operation
|
||||
(e.g. join request created) so the user is not shown a generic error when only
|
||||
the email failed.
|
||||
"""
|
||||
def send(email_address, token) when is_binary(email_address) and is_binary(token) do
|
||||
confirm_url = url(~p"/confirm_join/#{token}")
|
||||
|
|
@ -32,12 +32,14 @@ defmodule MvWeb.Emails.JoinConfirmationEmail do
|
|||
locale: Gettext.get_locale(MvWeb.Gettext)
|
||||
}
|
||||
|
||||
new()
|
||||
|> from(Mailer.mail_from())
|
||||
|> to(email_address)
|
||||
|> subject(subject)
|
||||
|> put_view(MvWeb.EmailsView)
|
||||
|> render_body("join_confirmation.html", assigns)
|
||||
|> Mailer.deliver()
|
||||
email =
|
||||
new()
|
||||
|> from(Mailer.mail_from())
|
||||
|> to(email_address)
|
||||
|> subject(subject)
|
||||
|> put_view(MvWeb.EmailsView)
|
||||
|> render_body("join_confirmation.html", assigns)
|
||||
|
||||
Mailer.deliver(email, Mailer.smtp_config())
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue