Pow v0.1.0-rc.1 Pow.Phoenix.Mailer behaviour View Source

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
  use Swoosh.Mailer, otp_app: :my_app
  import Swoosh.Email

  def cast(email) do
    %Swoosh.Email{}
    |> from({"My App", "myapp@example.com"})
    |> to({"", email.user.email})
    |> subject(email.subject)
    |> text_body(email.text)
    |> html_body(email.html)
  end

  def process(email), do: deliver(email)
end

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

Link to this section Summary

Link to this section Functions

Link to this section Callbacks

Link to this callback process(any) View Source
process(any()) :: any()