> ## Documentation Index
> Fetch the complete documentation index at: https://cloud.laravel.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Email

> Send transactional email from your environments with Resend

## Introduction

Laravel Cloud integrates directly with [Resend](https://resend.com), so you can send transactional email from your applications without copying API keys between two dashboards.

You connect a Resend account to your organization once, then attach email to any environment, choosing or creating a sending domain along the way. Laravel Cloud creates a sending key for that environment and injects the mail environment variables your application needs.

Resend is the only email provider Laravel Cloud manages for you. You may still configure any other provider manually through your environment variables.

## Connecting a Resend account

A Resend account is connected at the organization level, and each organization may connect one account. Before connecting, you will need an existing [Resend account](https://resend.com/signup).

You may connect your account from your organization's settings, as described below, or the first time you [attach email to an environment](#attaching-email-to-an-environment). Either way, Laravel Cloud sends you to Resend to approve access.

<Steps>
  <Step title="Open your integration settings">
    From your organization, go to "Settings", then open the "Integrations" tab and find the "Resend" panel.
  </Step>

  <Step title="Connect your account">
    Click "Connect". Laravel Cloud redirects you to Resend, where you approve access for Laravel Cloud. You do not need to create or paste an API key.

    When Resend asks which permission to grant, choose "Full access". Without it, Laravel Cloud cannot import your existing domains or set up the webhooks it needs.
  </Step>

  <Step title="Review your imported domains">
    After you approve access, Laravel Cloud imports the sending domains that already exist in your Resend account and begins tracking their verification status.
  </Step>
</Steps>

Connecting and disconnecting a Resend account requires the "Edit organization integrations" permission, which the Admin and Manager roles include. See the [roles and permissions documentation](/docs/rbac) to learn more.

## Sending domains

A sending domain is a domain you have proven you own, which allows Resend to send email on its behalf. You may create a sending domain while [attaching email to an environment](#attaching-email-to-an-environment), or manage all of your sending domains from the "Resend" panel in your organization's integration settings.

Sending domains have their own permissions: "View sending domains", "Create sending domains", "Verify sending domains", and "Delete sending domains". The Admin and Manager roles include all four, while the Developer and Viewer roles include none. With [custom roles](/docs/rbac#custom-roles), you may grant them separately, such as allowing a member to add and verify domains without being able to delete them.

### Adding a domain

Enter the domain you want to send from and choose the region Resend should send from. In your organization's integration settings, click "Add domain". When attaching email to an environment, click "Create new sending domain", then "Create".

Resend supports the following regions:

| Region | Location |
| - | - |
| `us-east-1` | US East (N. Virginia) |
| `eu-west-1` | EU West (Ireland) |
| `sa-east-1` | South America (São Paulo) |
| `ap-northeast-1` | Asia Pacific (Tokyo) |

We recommend sending from a subdomain such as `notifications.example.com` rather than your root domain. Doing so keeps the sending reputation of your application's email separate from any other email sent from your domain.

### Verifying a domain

After you add a domain, Laravel Cloud shows the DNS records you need to create at your DNS provider. Add each record exactly as shown, then click "Verify records" to have Resend check them.

Verification is not instant. DNS changes can take up to 72 hours to propagate, and Laravel Cloud updates the domain's status as Resend reports progress. A domain moves through the following states:

| Status | Meaning |
| - | - |
| Not verified | The records have not been checked yet |
| Verifying | Resend is checking your records |
| Verified | Your records are correct and you can send from this domain |
| Failed | One or more records could not be verified |

If verification fails, Laravel Cloud lists the records that did not pass so you can correct them, then retry. Open a domain from the list at any time to review its configuration, its DNS records, and the status of each individual record.

### Deleting a domain

Deleting a domain from Laravel Cloud also deletes it from Resend, and your application can no longer send email from that domain. Environments that were sending from the domain keep their sending key, but their messages are rejected until you point them at a verified domain.

## Attaching email to an environment

Sending domains belong to your organization, but sending keys belong to an environment. Attach email to each environment that needs to send. Attaching email requires the "Edit environments" permission, which the Developer role also includes.

<Steps>
  <Step title="Add the resource">
    Open the environment's canvas, click "Add resource", then choose "Emails". If your organization has not connected a Resend account yet, click "Connect Resend" and approve "Full access" in Resend. Laravel Cloud then returns you to the same environment.
  </Step>

  <Step title="Choose a sending domain">
    Select a verified domain from the list. To use a domain that is not verified yet, select it to view its DNS records. To send from a new domain, click "Create new sending domain", enter the domain and region, then click "Create".

    For a new or unverified domain, add the DNS records at your DNS provider and click "Verify records". Once Resend [verifies the domain](#verifying-a-domain), click "Continue".
  </Step>

  <Step title="Configure the sender and sending key">
    Enter the sender address and sender name your application should send from. Then choose a sending key:

    * **Create a new key** creates a full access key used only by this environment, so you may rotate or revoke it without affecting anything else. Because the key has full access, your application may also use it for other Resend features, such as managing contacts or audiences.
    * **Reuse existing key** shares a key already used by another environment in your organization. Rotating or revoking it later affects every environment that uses it.

    Resend does not allow full access keys to be limited to a single domain, so a key created for one environment can manage your entire Resend account. Treat it with the same care as any other production credential.
  </Step>

  <Step title="Review and confirm">
    Review the variables Laravel Cloud will inject, then click "Confirm and attach email".
  </Step>

  <Step title="Deploy the environment">
    Deploy the environment for your application to receive the mail variables.
  </Step>
</Steps>

Once attached, the canvas displays an "Email" card showing the sender address and the name of the sending key. To open the key in Resend, or to detach email from the environment, use the card's options menu.

### Injected environment variables

Attaching email injects the following variables into the environment:

```ini theme={null}
RESEND_API_KEY=re_xxxxxxxxxxxx
MAIL_MAILER=resend
MAIL_FROM_ADDRESS=hello@notifications.example.com
MAIL_FROM_NAME="Your application name"
```

`MAIL_FROM_ADDRESS` and `MAIL_FROM_NAME` use the sender address and sender name you entered when attaching email. Laravel Cloud encrypts `RESEND_API_KEY` and masks it in your environment's variables, the same way it handles your database password.

Custom environment variables take priority over injected ones, so you may override any of these values by defining a custom variable with the same name, then deploying. See the [environment variables documentation](/docs/environments#environment-variables) to learn more.

### Configuring your application

<Tabs>
  <Tab title="Laravel">
    Laravel ships with a Resend mail transport, which requires Resend's PHP SDK. Install it so your application can use the transport:

    ```sh theme={null}
    composer require resend/resend-php
    ```

    Laravel reads the injected variables directly, so no further configuration is required. Send mail as you normally would:

    ```php theme={null}
    use Illuminate\Support\Facades\Mail;

    Mail::to($user)->send(new OrderShipped($order));
    ```
  </Tab>

  <Tab title="Other frameworks">
    Laravel Cloud injects the same variables for every runtime, since `RESEND_API_KEY` is what your application needs regardless of the language it is written in. Read the key from your environment and pass it to [Resend's API](https://resend.com/docs/api-reference/introduction) or one of their SDKs.
  </Tab>
</Tabs>

<Tip>
  If you queue your mail, a delivery problem may appear as a failed job rather than a failed request. [Laravel Nightwatch](https://nightwatch.laravel.com) traces your queued mail jobs and alerts you when they start failing.
</Tip>

## Detaching and disconnecting

Detaching email from an environment deletes that environment's sending key from Resend and stops the mail variables from being injected. Deploy the environment afterward so your application stops receiving them. Your sending domains are left untouched, and other environments continue sending.

Disconnecting your Resend account from the organization is broader. Laravel Cloud deletes the sending key belonging to every attached environment, detaches email from those environments, and discards the access it was granted during the connection flow.

Your Resend account itself is unaffected. Your sending domains stay in Resend and keep their verification, so reconnecting later imports them again without repeating DNS setup.

<Warning>
  Disconnecting stops every environment in the organization from sending email. Deploy each affected environment afterward so it stops receiving the mail variables.
</Warning>

## Pricing

Laravel Cloud does not charge for the Resend integration, and it does not bill you for the email you send. You pay Resend directly under your own Resend plan.
