Search documentation of phoenix_kit

# PhoenixKit.Email.Provider behaviour (phoenix_kit v1.7.87)

Copy Markdown View Source

Unified email provider behaviour.

Covers interception (pre/post send hooks), DB templates, AWS config, and provider detection. The emails package implements this fully. The DefaultProvider is a no-op that passes emails through unchanged.

## Summary

### Callbacks

adapter_to_provider_name(atom, t)
aws_configured?()
get_active_template_by_name(t)
get_aws_access_key()
get_aws_region()
get_aws_secret_key()
get_source_module(map)
handle_after_send(t, arg2)
intercept_before_send(t, keyword)
render_template(map, map)
render_template(map, map, t)
send_test_tracking_email(t, arg2)
track_usage(map)

### Functions

current()

Returns the configured email provider module, defaulting to DefaultProvider.

## Callbacks

# adapter_to_provider_name(atom, t)

    @callback adapter_to_provider_name(atom(), String.t()) :: String.t()

# aws_configured?()

    @callback aws_configured?() :: boolean()

# get_active_template_by_name(t)

    @callback get_active_template_by_name(String.t()) :: map() | nil

# get_aws_access_key()

    @callback get_aws_access_key() :: String.t()

# get_aws_region()

    @callback get_aws_region() :: String.t()

# get_aws_secret_key()

    @callback get_aws_secret_key() :: String.t()

# get_source_module(map)

    @callback get_source_module(map()) :: String.t() | nil

# handle_after_send(t, arg2)

    @callback handle_after_send(Swoosh.Email.t(), {:ok, any()} | {:error, any()}) :: :ok

# intercept_before_send(t, keyword)

    @callback intercept_before_send(
      Swoosh.Email.t(),
      keyword()
    ) :: Swoosh.Email.t()

# render_template(map, map)

    @callback render_template(map(), map()) :: map()

# render_template(map, map, t)

    @callback render_template(map(), map(), String.t()) :: map()

# send_test_tracking_email(t, arg2)

    @callback send_test_tracking_email(String.t(), String.t() | nil) ::
      {:ok, Swoosh.Email.t()} | {:error, any()}

# track_usage(map)

    @callback track_usage(map()) :: :ok

## Functions

# current()

    @spec current() :: module()

Returns the configured email provider module, defaulting to DefaultProvider.