mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
28 lines
595 B
Elixir
28 lines
595 B
Elixir
defmodule PhilomenaWeb.PowMailer do
|
|
use Pow.Phoenix.Mailer
|
|
alias PhilomenaWeb.Mailer
|
|
alias Philomena.Users.User
|
|
import Bamboo.Email
|
|
|
|
def cast(%{
|
|
user: %User{email: email},
|
|
subject: subject,
|
|
text: text,
|
|
html: html,
|
|
assigns: _assigns
|
|
}) do
|
|
# Build email struct to be used in `process/1`
|
|
new_email(
|
|
to: email,
|
|
from: Application.get_env(:philomena, :mailer_address),
|
|
subject: subject,
|
|
text_body: text,
|
|
html_body: html
|
|
)
|
|
end
|
|
|
|
def process(email) do
|
|
email
|
|
|> Mailer.deliver_later()
|
|
end
|
|
end
|