An Adapter for the Bamboo email app.
The package can be installed as:
mix.exs
:def deps do
[{:bamboo_sparkpost, "~> 2.0"}]
end
def application do
[applications: [:bamboo]]
end
# In your config/config.exs file
config :my_app, MyApp.Mailer,
adapter: Bamboo.SparkPostAdapter,
api_key: "my-api-key"
If you are using SparkPost EU, make sure to also add this :bamboo
configuration:
# In your config/config.exs file
config :bamboo,
sparkpost_base_uri: "https://api.eu.sparkpost.com"
Follow Bamboo Getting Started Guide
Optionally add hackney_options
or request_headers
# In your config/config.exs file
config :my_app, MyApp.Mailer,
adapter: Bamboo.SparkPostAdapter,
api_key: "my-api-key",
hackney_options: [
connect_timeout: 8_000,
recv_timeout: 5_000
],
request_headers: [{"X-MSYS-SUBACCOUNT", "123"}]
The SparkPost adapter provides a helper module for setting tags and other meta data
import Bamboo.SparkPostHelper
email
|> tag("my-tag")
|> mark_transactional
|> disable_open_tracking
|> disable_click_tracking
|> meta_data(foo: "bar")