mix phx.gen.notifier (Phoenix v1.6.6) View Source

Generates a notifier that delivers emails by default.

$ mix phx.gen.notifier Accounts User welcome_user reset_password confirmation_instructions

This task expects a context module name, followed by a notifier name and one or more message names. Messages are the functions that will be created prefixed by "deliver", so the message name should be "snake_case" without punctuation.

Additionally a context app can be specified with the flag --context-app, which is useful if the notifier is being generated in a different app under an umbrella.

$ mix phx.gen.notifier Accounts User welcome_user --context-app marketing

The app "marketing" must exist before the command is executed.

Link to this section Summary

Functions

Print mailer instructions if mailer is not defined.

Link to this section Functions

Link to this function

maybe_print_mailer_installation_instructions(context)

View Source

Specs

maybe_print_mailer_installation_instructions(%Mix.Phoenix.Context{
  alias: term(),
  base_module: term(),
  basename: term(),
  context_app: term(),
  dir: term(),
  file: term(),
  generate?: term(),
  module: term(),
  name: term(),
  opts: term(),
  schema: term(),
  test_file: term(),
  test_fixtures_file: term(),
  web_module: term()
}) :: %Mix.Phoenix.Context{
  alias: term(),
  base_module: term(),
  basename: term(),
  context_app: term(),
  dir: term(),
  file: term(),
  generate?: term(),
  module: term(),
  name: term(),
  opts: term(),
  schema: term(),
  test_file: term(),
  test_fixtures_file: term(),
  web_module: term()
}

Print mailer instructions if mailer is not defined.

This is useful for applications that were created without the mailer.