FlowmailerAdapter
A FlowMailer Adapter for the Bamboo email app.
Installation
-
Add dependency in your
mix.exs:
def deps do
[
{:flowmailer_adapter, "~> 0.1.0"}
]
end- Ensure bamboo is started before your application:
def application do
[applications: [:bamboo]]
end- 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
Follow Bamboo Getting Started Guide
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
endExample
defmodule MyApp.Mail do
import Bamboo.FlowMailerHelper
def send(email) do
email
|> from("test@test.com")
|> set_flow("paymnet")
end
endDocumentation published on https://hexdocs.pm/flowmailer_adapter.