2020-01-26 20:36:50 +00:00
|
|
|
defmodule Mobilizon.Web.Email.Mailer do
|
2018-10-11 15:37:39 +00:00
|
|
|
@moduledoc """
|
2019-09-07 21:58:53 +00:00
|
|
|
Mobilizon Mailer.
|
2018-10-11 15:37:39 +00:00
|
|
|
"""
|
|
|
|
use Bamboo.Mailer, otp_app: :mobilizon
|
2021-04-20 13:02:24 +00:00
|
|
|
|
|
|
|
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
|
2018-10-11 15:37:39 +00:00
|
|
|
end
|