A Bamboo adapter for Sparkpost email service
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib/bamboo/adapters
test
.formatter.exs
.gitignore
.travis.yml
CHANGELOG.md
README.md
mix.exs
mix.lock

README.md

Bamboo.SparkPostAdapter

Build Status

An Adapter for the Bamboo email app.

Installation

The package can be installed as:

  1. Add bamboo_sparkpost to your list of dependencies in mix.exs:
def deps do
  [{:bamboo_sparkpost, "~> 1.1"}]
end
  1. Ensure bamboo is started before your application:
def application do
  [applications: [:bamboo]]
end
  1. Add your SparkPost API key to your config
# 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"
  1. Follow Bamboo Getting Started Guide

  2. 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"}]

Advanced Usage

The SparkPost adapter provides a helper module for setting tags and other meta data

Examples

import Bamboo.SparkPostHelper

email
|> tag("my-tag")
|> mark_transactional
|> disable_open_tracking
|> disable_click_tracking
|> meta_data(foo: "bar")