This guides utilizes an open source library contributed by a community member. It’s not developed, maintained, or supported by Resend directly.

Prerequisites

To get the most out of this guide, you’ll need to:

1. Install

Install by adding resend to your list of dependencies in mix.exs:

def deps do
  [
    {:resend, "~> 0.4.0"}
  ]
end

2. Send email using Swoosh

This library includes a Swoosh adapter to make using Resend with a new Phoenix project as easy as possible. All you have to do is configure your Mailer:

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 in runtime.exs:

config :my_app, MyApp.Mailer, adapter: Resend.Swoosh.Adapter

3. Try it yourself

Phoenix Example

See the full source code.