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

An adapter that sends email using the Mailgun API.

For reference: Mailgun API docs


Mailgun adapter requires Plug to work properly.


# config/config.exs
config :sample, Sample.Mailer,
  adapter: Swoosh.Adapters.Mailgun,
  api_key: "my-api-key",
  domain: "avengers.com"

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

Provider options

  • :custom_vars (used to translate to v:, now h:X-Mailgun-Variables)
  • :sending_options (o:)
  • :template_name (template)
  • :recipient_vars (recipient-variables)
  • :tags (o:tag, was added in before :sending_options)

Custom headers

Headers added via Email.header/3 will be translated to (h:) values that Mailgun recognizes.

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.