View Source Pow.Phoenix.Mailer behaviour (Pow v1.0.36)

This module provides an API for mails to be sent by Pow.

Pow mails is build with Pow.Phoenix.Mailer.Mail structs, and consists of :subject, :text, :html and :user keys.

Usage

defmodule MyAppWeb.Pow.Mailer do
  use Pow.Phoenix.Mailer
  require Logger

  @impl true
  def cast(%{user: user, subject: subject, text: text, html: html, assigns: _assigns}) do
    # Build email struct to be used in `process/1`

    %{to: user.email, subject: subject, text: text, html: html}
  end

  @impl true
  def process(email) do
    # Send email

    Logger.debug("E-mail sent: #{inspect email}")
  end
end

Remember to update configuration with mailer_backend: MyAppWeb.Pow.Mailer

Summary

Callbacks

@callback cast(Pow.Phoenix.Mailer.Mail.t()) :: any()
@callback process(any()) :: any()

Functions