FlowmailerAdapter

A FlowMailer Adapter for the Bamboo email app.

Installation

  1. Add dependency in your mix.exs:
def deps do
  [
    {:flowmailer_adapter, "~> 0.1.0"}
  ]
end
  1. Ensure bamboo is started before your application:
def application do
  [applications: [:bamboo]]
end
  1. Add FlowMailer config into your config:
config :my_app, MyApp.Mailer, adapter: Bamboo.FlowMailerAdapter
  flowmailer_client_id: "your-client-id",
  flowmailer_account_id: "your-account-id",
  flowmailer_client_secret: "your-client-secret"
  # flowmailer_client_secret: {:system, "FLOWMAILER_CLIENT_SECRET"} format as value also feasible
  1. Follow Bamboo Getting Started Guide

  2. Optionally add hackney_options

# In your config/config.exs file
config :my_app, MyApp.Mailer,
  adapter: Bamboo.FlowMailerAdapter,
  hackney_options: [
    connect_timeout: 8_000,
    recv_timeout: 5_000
  ]

Using templates

The FlowMailer adapter provides a helper module for setting the flow of an email.

defmodule MyApp.Mail do
  import Bamboo.FlowMailerHelper

  def some_email do
    email
    |> set_flow("invoice")
  end
end

Example

defmodule MyApp.Mail do
  import Bamboo.FlowMailerHelper

  def send(email) do
    email
    |> from("test@test.com")
    |> set_flow("paymnet")
  end
end

Documentation published on https://hexdocs.pm/flowmailer_adapter.