Skip to main content
Resend Docs
current

Search documentation

Type to search this documentation.

On this pageOverview

Send emails with Phoenix

Learn how to send your first email using Phoenix and the Resend Elixir SDK.

Before you start, you'll need:

  1. Install

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

    mix.exs
    def deps do
      [
        {:resend, "~> 0.4.5"}
      ]
    end
  2. Send 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 in runtime.exs:

    prod.exs
    config :my_app, MyApp.Mailer, adapter: Resend.Swoosh.Adapter
    runtime.exs
    config :my_app, MyApp.Mailer, api_key: "re_xxxxxxxxx"
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu