Skip to content

Commit

Permalink
Do not fail when trial email errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ukutaht committed Sep 3, 2020
1 parent 9feda6a commit b930b82
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/workers/send_trial_notifications.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,33 @@ defmodule Plausible.Workers.SendTrialNotifications do

defp send_one_week_reminder(user) do
PlausibleWeb.Email.trial_one_week_reminder(user)
|> Plausible.Mailer.send_email()
|> send_email()
end

defp send_tomorrow_reminder(user) do
usage = Plausible.Billing.usage(user)

PlausibleWeb.Email.trial_upgrade_email(user, "tomorrow", usage)
|> Plausible.Mailer.send_email()
|> send_email()
end

defp send_today_reminder(user) do
usage = Plausible.Billing.usage(user)

PlausibleWeb.Email.trial_upgrade_email(user, "today", usage)
|> Plausible.Mailer.send_email()
|> send_email()
end

defp send_over_reminder(user) do
PlausibleWeb.Email.trial_over_email(user)
|> Plausible.Mailer.deliver_now()
|> send_email()
end

defp send_email(email) do
try do
Plausible.Mailer.send_email(email)
rescue
_ -> nil
end
end
end

0 comments on commit b930b82

Please sign in to comment.