Send emails with Phoenix
Prerequisites
Section titled “Prerequisites”Before you start, you'll need:
- A Resend API key
- A verified domain
Install
Install by adding
resendto your list of dependencies inmix.exs:mix.exs def deps do [ {:resend, "~> 0.4.5"} ] endSend email using Swoosh
This library includes a Swoosh adapter to make using Resend with a new Phoenix project straightforward. Configure your Mailer:
elixir config :my_app, MyApp.Mailer, adapter: Resend.Swoosh.Adapter, api_key: System.fetch_env!("RESEND_API_KEY")If you're configuring your app for production, configure your adapter in
prod.exs, and your API key from the environment inruntime.exs:prod.exs config :my_app, MyApp.Mailer, adapter: Resend.Swoosh.Adapterruntime.exs config :my_app, MyApp.Mailer, api_key: "re_xxxxxxxxx"
Examples
Section titled “Examples”Phoenix App
Full Phoenix web framework application
Basic Send
Basic email sending
Attachments
Send emails with file attachments
Templates
Send emails using Resend hosted templates
Scheduling
Schedule emails for future delivery
Audiences
Manage contacts and audiences
Domains
Create and manage sending domains
Inbound Webhooks
Receive and process inbound emails
Double Opt-in
Double opt-in subscription flow