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

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.



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:, subject: subject, text: text, html: html}

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

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

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

Link to this section Summary

Link to this section Callbacks

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

Link to this section Functions