# Send emails with Elixir

:::callout{intent="info"}
This guides utilizes an [open source
library](https://github.com/elixir-saas/resend-elixir) contributed by a
community member. It's not developed, maintained, or supported by Resend
directly.
:::

## Prerequisites

Before you start, you'll need:

- A Resend [API key](/guides/get-started-create-an-api-key)
- A [verified domain](/guides/get-started-add-a-domain)

## Guide

:::::steps
::::step{title="Install"}
Install by adding `resend` to your list of dependencies in `mix.exs`:

:::code-group
```elixir mix.exs theme={"theme":{"light":"github-light","dark":"vesper"}}
def deps do
  [
    {:resend, "~> 0.4.0"}
  ]
end
```
:::
::::

:::step{title="Send email using HTML"}
The easiest way to send an email is by using the `html` parameter.

```elixir send.exs theme={"theme":{"light":"github-light","dark":"vesper"}}
client = Resend.client(api_key: System.get_env("RESEND_API_KEY"))

Resend.Emails.send(client, %{
  from: "Acme <onboarding@resend.dev>",
  to: ["delivered@resend.dev"],
  subject: "hello world",
  html: "<strong>it works!</strong>"
})
```
:::
:::::

## Examples

::::card-grid
:::card{title="Basic Send" href="https://github.com/resend/resend-examples/blob/main/elixir-resend-examples/examples/basic_send.exs" icon="arrow-up-right-from-square"}
Basic email sending
:::

:::card{title="Attachments" href="https://github.com/resend/resend-examples/blob/main/elixir-resend-examples/examples/with_attachments.exs" icon="arrow-up-right-from-square"}
Send emails with file attachments
:::

:::card{title="Templates" href="https://github.com/resend/resend-examples/blob/main/elixir-resend-examples/examples/with_template.exs" icon="arrow-up-right-from-square"}
Send emails using Resend hosted templates
:::

:::card{title="Scheduling" href="https://github.com/resend/resend-examples/blob/main/elixir-resend-examples/examples/scheduled_send.exs" icon="arrow-up-right-from-square"}
Schedule emails for future delivery
:::

:::card{title="Audiences" href="https://github.com/resend/resend-examples/blob/main/elixir-resend-examples/examples/audiences.exs" icon="arrow-up-right-from-square"}
Manage contacts and audiences
:::

:::card{title="Domains" href="https://github.com/resend/resend-examples/blob/main/elixir-resend-examples/examples/domains.exs" icon="arrow-up-right-from-square"}
Create and manage sending domains
:::

:::card{title="Inbound Webhooks" href="https://github.com/resend/resend-examples/blob/main/elixir-resend-examples/examples/inbound.exs" icon="arrow-up-right-from-square"}
Receive and process inbound emails
:::

:::card{title="Double Opt-in" href="https://github.com/resend/resend-examples/tree/main/elixir-resend-examples/examples/double_optin" icon="arrow-up-right-from-square"}
Double opt-in subscription flow
:::

:::card{title="Phoenix App" href="https://github.com/resend/resend-examples/tree/main/elixir-resend-examples/phoenix_app" icon="arrow-up-right-from-square"}
Full Phoenix web framework application
:::
::::

## Related pages

- [Send emails with Phoenix](./get-started-send-with-phoenix.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
