Swoosh.Adapters.Mandrill (Swoosh v1.3.3) View Source

An adapter that sends email using the Mandrill API.

It supports both the send and send-template endpoint. In order to use the latter you need to set template_name in the provider_options map on Swoosh.Email.

For reference: Mandrill API docs

Example

# config/config.exs
config :sample, Sample.Mailer,
  adapter: Swoosh.Adapters.Mandrill,
  api_key: "my-api-key"

# lib/sample/mailer.ex
defmodule Sample.Mailer do
  use Swoosh.Mailer, otp_app: :sample
end

Example of using the send-template endpoint

import Swoosh.Email

new()
|> from({"T Stark", "tony.stark@example.com"})
|> to({"Steve Rogers", "steve.rogers@example.com"})
|> subject("Hello, Avengers!")
|> put_provider_option(:template_name, "welcome")
|> put_provider_option(:template_content, [%{"name" => "START_DATE", "content" => "Next Monday"}])

Link to this section Summary

Link to this section Functions

Callback implementation for Swoosh.Adapter.validate_config/1.

Callback implementation for Swoosh.Adapter.validate_dependency/0.