Swoosh builds and sends email from Elixir apps via many provider adapters, SMTP, and local or test mailboxes.
Overview
Swoosh helps Elixir applications compose, deliver, and test email. You define mailer modules, build messages with the Email API, and send through an adapter chosen in configuration.
Dozens of built-in adapters cover SMTP, SendGrid, Mailgun, Postmark, Mandrill, Amazon SES, and many other transactional providers, plus HTTP clients such as Hackney, Finch, or Req for API-based services. Local, Test, Sandbox, and Mailpit adapters support development and automated tests, including a browser mailbox preview plug.
Messages support HTML and text bodies, attachments from paths or Plug uploads, and the Recipient protocol so custom structs work as addresses. Optional telemetry events fire around deliver and deliver_many. JSON encoding defaults to Jason with configurable alternatives.
The library integrates with Phoenix controllers and can preview stored mail in the browser when using the Local adapter.
Key features
- Many transactional email provider adapters
- SMTP and Mua delivery options
- Local, Test, and Sandbox adapters
- Browser mailbox preview plug
- Attachment and Recipient protocol support
- Hackney, Finch, or Req API clients
- Deliver telemetry hooks
- Phoenix-friendly mailer modules
Use cases
- Transactional email from Phoenix apps
- Switching email providers via config
- Testing outbound mail in ExUnit
- Local email inspection during development