mobilizon/lib/web/email/mailer.ex
Thomas Citharel e841fb6fbb
Move mailer from Bamboo to Swoosh
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-04-05 12:38:02 +02:00

21 lines
507 B
Elixir

defmodule Mobilizon.Web.Email.Mailer do
@moduledoc """
Mobilizon Mailer.
"""
use Swoosh.Mailer, otp_app: :mobilizon
alias Mobilizon.Service.ErrorReporting.Sentry
@spec send_email(Swoosh.Email.t()) :: Swoosh.Email.t()
def send_email(email) do
Mobilizon.Web.Email.Mailer.deliver(email)
rescue
error ->
Sentry.capture_exception(error,
stacktrace: __STACKTRACE__,
extra: %{extra: "Error while sending email"}
)
reraise error, __STACKTRACE__
end
end