Swoosh.Adapter behaviour (Swoosh v1.3.4) View Source

Specification of the email delivery adapter.

Link to this section Summary

Callbacks

Delivers an email with the given config.

Delivers multiple emails with the given config in one request. Some email providers allow multiple messages to be sent in one HTTP request, for example Mailjet allow this. Check your provider's documentation to see if that is possible.

Link to this section Types

Specs

config() :: Keyword.t()

Specs

email() :: Email.t()

Specs

t() :: module()

Link to this section Functions

Link to this function

validate_config(required_config, config)

View Source

Specs

validate_config([atom()], Keyword.t()) :: :ok | no_return()
Link to this function

validate_dependency(required_deps)

View Source

Specs

validate_dependency([module() | {atom(), module()}]) ::
  :ok | {:error, [module() | {:atom | module()}]}

Link to this section Callbacks

Link to this callback

deliver(%Swoosh.Email{}, config)

View Source

Specs

deliver(
  %Swoosh.Email{
    assigns: term(),
    attachments: term(),
    bcc: term(),
    cc: term(),
    from: term(),
    headers: term(),
    html_body: term(),
    private: term(),
    provider_options: term(),
    reply_to: term(),
    subject: term(),
    text_body: term(),
    to: term()
  },
  config()
) :: {:ok, term()} | {:error, term()}

Delivers an email with the given config.

Link to this callback

deliver_many(list, config)

View Source (optional)

Specs

deliver_many(
  [
    %Swoosh.Email{
      assigns: term(),
      attachments: term(),
      bcc: term(),
      cc: term(),
      from: term(),
      headers: term(),
      html_body: term(),
      private: term(),
      provider_options: term(),
      reply_to: term(),
      subject: term(),
      text_body: term(),
      to: term()
    }
  ],
  config()
) :: {:ok, term()} | {:error, term()}

Delivers multiple emails with the given config in one request. Some email providers allow multiple messages to be sent in one HTTP request, for example Mailjet allow this. Check your provider's documentation to see if that is possible.

Specs

validate_config(config()) :: :ok | no_return()
Link to this callback

validate_dependency()

View Source (optional)

Specs

validate_dependency() :: :ok | [module() | {atom(), module()}]