defmodule Meta.Accounts.UserNotifier do alias Meta.Mailer import Bamboo.Email defp deliver(to, body) do _msg = Mailer.template() |> to(to) |> subject("Recycled Cloud User Management Notification") |> text_body(body) |> Mailer.deliver_now() {:ok, %{to: to, body: body}} end @doc """ Deliver instructions to confirm account. """ def deliver_confirmation_instructions(user, url) do deliver(user.email, """ ============================== Hi #{user.username}, You can confirm your account by visiting the URL below: #{url} If you didn't create an account with us, please ignore this. ============================== """) end @doc """ Deliver instructions to reset a user password. """ def deliver_reset_password_instructions(user, url) do deliver(user.email, """ ============================== Hi #{user.username}, You can reset your password by visiting the URL below: #{url} If you didn't request this change, please ignore this. ============================== """) end @doc """ Deliver instructions to update a user email. """ def deliver_update_email_instructions(user, url) do deliver(user.email, """ ============================== Hi #{user.username}, You can change your email by visiting the URL below: #{url} If you didn't request this change, please ignore this. ============================== """) end end