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

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_layouts do
    plug :put_pow_mailer_layouts, html: {MyAppWeb.Layouts, :email}, text: {MyAppWeb.Layouts, :email_text}
  end

  # ...

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

    pow_routes()
  end

  # ...

  defp put_pow_mailer_layouts(conn, layout), do: put_private(conn, :put_pow_mailer_layouts, layouts)
end

If a specific format is specified, such as html: {MyAppWeb.Layouts, :email} then only the html format will use layout, while text will not.

Summary

Functions

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

Types

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

Functions

Link to this function

new(conn, user, arg, assigns)

View Source
@spec 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 module to call.

Link to this function

put_layout(assigns, layouts, format)

View Source