# Setting up email delivery with Resend

You create an API key at Resend, store it under Connections, and then monitor status and sending domains directly in MainPath.

> Source: https://www.mainpath.ai/en/docs/smtp-resend-setup/

Resend is integrated into MainPath as its own connection type. You store only an API key; MainPath handles sending through SMTP (`smtp.resend.com`, user `resend`), the status display, and the monitoring of your sending domains.

```mermaid
flowchart LR
  cred["Organization's Resend connection"]
  svc["Your project's backend"]
  api["Resend API / SMTP"]
  mx["Recipient's mail server"]
  svc -->|"reads credentials"| cred
  svc -->|"API key"| api
  api --> mx
```

For a different provider, create a generic **Email (SMTP)** connection instead; [Email delivery]({{< relref "email-delivery" >}}) describes the differences.

## Preparing at Resend

1. Create an account at [resend.com](https://resend.com/) or sign in.
2. Under **Domains**, enter your sender domain and set the displayed DNS records for SPF, DKIM, and DMARC at your domain provider; sending is only enabled after verification. You can also take care of this step later from within MainPath.
3. Under **API Keys**, create a key and copy it.

## Creating the connection in MainPath

1. Open **Connections** in the sidebar and click **Add connection**.
2. Choose the **Resend** tile.
3. Enter the **API key**, optionally with a **sender name** and a **sender address** from your verified sending domain.
4. Save. The connection is then available in projects under **Mail account**.

## Monitoring status and domains in MainPath

The Resend connection's tile opens its detail view with the **status** of the connection, your sending domains with their verification status, and for each domain the DNS records with type, name, value, and check status. With **Add domain** you create new sending domains right here.

## Selecting the mail account in the project

When editing the project, select the Resend connection under **Mail account** in the backend's settings. Resend, SendGrid, Mailtrap, and SMTP connections are listed there together.

## If something does not work

If the **status** shows an error, check the API key and create a new one at Resend if necessary. If Resend rejects sending or mail does not arrive, the sending domain is usually not verified yet; compare the DNS records in the detail view with those at your domain provider. If a domain is missing from the list, create it with **Add domain** and set the displayed records.

## See also

- [Connections]({{< relref "connections" >}})
- [Email delivery]({{< relref "email-delivery" >}})
- [SMTP with Mailtrap]({{< relref "smtp-mailtrap-setup" >}})
- [SMTP with SendGrid]({{< relref "smtp-sendgrid-setup" >}})

