Pow.Phoenix.Mailer.Mail (Pow v1.0.25) View Source

Module that renders html and text version of e-mails.

Custom layout

By default no layout is used to render the templates. You can set :pow_mailer_layout in conn.private the same way as you set :phoenix_layout to render a layout for the template.

This is how you can set the mailer layout:

defmodule MyAppWeb.Router do
  # ...

  pipeline :pow_email_layout do
    plug :put_pow_mailer_layout, {MyAppWeb.LayoutView, :email}
  end

  # ...

  scope "/" do
    pipe_through [:browser, :pow_email_layout]

    pow_routes()
  end

  # ...

  defp put_pow_mailer_layout(conn, layout), do: put_private(conn, :pow_mailer_layout, layout)
end

You can use atom or binary as template. If a binary is used then only format that it ends with will be used, e.g. using "email.html" will result in no text layout being used.

Link to this section Summary

Functions

Returns a populated %Pow.Phoenix.Mailer.Mail{} map.

Link to this section Types

Specs

t() :: %Pow.Phoenix.Mailer.Mail{
  assigns: term(),
  html: term(),
  subject: term(),
  text: term(),
  user: term()
}

Link to this section Functions

Link to this function

new(conn, user, arg, assigns)

View Source

Specs

new(Plug.Conn.t(), map(), {module(), atom()}, Keyword.t()) :: t()

Returns a populated %Pow.Phoenix.Mailer.Mail{} map.

If the configuration has :web_mailer_module, it will be used to find the template view module to call.