bamboo v0.6.0 Bamboo.Adapter behaviour

Behaviour for creating Bamboo adapters

All recipients in the Bamboo.Email struct will be normalized to a 2 item tuple of {name, address} when deliver through your mailer. For example, email.from |> elem(0) would return the name and email.from |> elem(1) would return the email address.

For more in-depth examples check out the adapters in Bamboo.

Example

defmodule Bamboo.CustomAdapter do
  @behaviour Bamboo.Adapter

  def deliver(email, config) do
    deliver_the_email_somehow(email)
  end

  def handle_config(config) do
    # Return the config if nothing special is required
    config

    # Or you could require certain config options
    if Map.get(config, :smtp_username) do
      config
    else
      raise "smtp_username is required in config, got #{inspect config}"
    end
  end
end

Summary

Callbacks

deliver(%, %{})

Specs

deliver(%Bamboo.Email{assigns: term, bcc: term, cc: term, from: term, headers: term, html_body: term, private: term, subject: term, text_body: term, to: term}, %{}) :: any
handle_config(map)

Specs

handle_config(map) :: map