mobilizon/lib/web/email/mailer.ex

35 lines
764 B
Elixir
Raw Normal View History

2020-01-26 20:36:50 +00:00
defmodule Mobilizon.Web.Email.Mailer do
@moduledoc """
2019-09-07 21:58:53 +00:00
Mobilizon Mailer.
"""
use Bamboo.Mailer, otp_app: :mobilizon
def send_email_later(email) do
try do
Mobilizon.Web.Email.Mailer.deliver_later!(email)
rescue
error ->
Sentry.capture_exception(error,
stacktrace: __STACKTRACE__,
extra: %{extra: "Error while sending email"}
)
reraise error, __STACKTRACE__
end
end
def send_email(email) do
try do
Mobilizon.Web.Email.Mailer.deliver_now!(email)
rescue
error ->
Sentry.capture_exception(error,
stacktrace: __STACKTRACE__,
extra: %{extra: "Error while sending email"}
)
reraise error, __STACKTRACE__
end
end
end