Swoosh.Adapters.Cloudflare (SwooshCloudflare v0.2.1)

Copy Markdown View Source

Swoosh adapter for Cloudflare Email Service REST API.

Configuration

config :my_app, MyApp.Mailer,
  adapter: Swoosh.Adapters.Cloudflare,
  api_token: System.get_env("CLOUDFLARE_EMAIL_TOKEN"),
  account_id: System.get_env("CLOUDFLARE_ACCOUNT_ID")

Success response

deliver/2 returns {:ok, %{delivered: [...], permanent_bounces: [...], queued: [...]}}.

Error responses

deliver/2 returns {:error, {status, reason}} for most errors, and {:error, {429, :rate_limited, retry_after_seconds}} for rate limiting, where retry_after_seconds is an integer or nil if the header was absent.

Limitations

  • New accounts can only send to verified addresses. Paid plans unlock general sending.
  • The from address must belong to a domain with Email Routing active in the Cloudflare account.
  • Maximum 50 recipients per email (combined to/cc/bcc).
  • Maximum message size: 5 MiB (25 MiB for verified accounts).
  • Transactional email only — bulk/marketing sending is not supported.

Summary

Functions

validate_config(config)

Callback implementation for Swoosh.Adapter.validate_config/1.

validate_dependency()

Callback implementation for Swoosh.Adapter.validate_dependency/0.