# Saleor email with Groundmail

Send Saleor store email through Groundmail by connecting Saleor's SMTP app to the Groundmail SMTP relay. Order, invoice, fulfillment, gift card and account emails then go out from your own domain.

---

## Prerequisites

- A Groundmail account with a [verified sending domain](https://docs.groundmail.dev/domains).
- An SMTP credential: in the Groundmail dashboard, open **SMTP** and choose **Create SMTP credential**. The password (`gmsmtp_…`) is shown once, so copy it. See [SMTP relay](https://docs.groundmail.dev/smtp).
- A Saleor store with the [SMTP app](https://docs.saleor.io/developer/app-store/apps/smtp/overview) installed. The app is open source, so you can run it next to a self-hosted Saleor.

Everything Saleor sends through the relay goes out as transactional email, so use it for order and account email. Never send cold email.

---

## Connect the SMTP app

1. In the Saleor Dashboard, open **Apps**, then the **SMTP** app, and click **Add configuration**.
2. Under **Connect SMTP server**, fill in:

| SMTP app field | Value |
|----------------|-------|
| Host | `smtp.groundmail.dev` |
| Port | `587` |
| User | `groundmail` |
| Password | Your SMTP credential (`gmsmtp_…`) |
| Encryption | STARTTLS (TLSv1.3+) |

3. Save the provider.
4. Under the sender section, set **Email** to an address on your verified domain, such as `orders@yourdomain.com`, and **Name** to your store name.
5. Turn on the events you want to send, such as order created, order confirmed, order fulfilled, invoice sent, account confirmation and password reset, and edit their templates.

Choose **STARTTLS**, not implicit TLS: the relay expects a STARTTLS connection on port 587.

The SMTP app gives up on an email if the SMTP server doesn't respond within 4 seconds. If your Saleor apps run somewhere with slow outbound connections, check your app logs for timeouts.

---

## Test it

Groundmail's simulator addresses work over SMTP and never reach a real inbox. Place a test order in your storefront, or create a customer account, with the email:

```text
delivered@simulator.groundmail.dev
```

Then confirm in Groundmail: open **Emails** in the dashboard, or run:

```bash
curl "https://api.groundmail.dev/emails?limit=5" \
  -H "Authorization: Bearer $GROUNDMAIL_API_KEY"
```

The email appears with the status `delivered` and `"test": true`. Use `bounce@simulator.groundmail.dev` to see a hard bounce. The full list is in [Testing](https://docs.groundmail.dev/testing#simulator-addresses).

---

## Troubleshooting

**No email for an event.** Check the event is turned on in the SMTP app configuration, and, if you limited the configuration to certain channels, that the order's channel is one of them.

**Authentication failed.** The username must be exactly `groundmail`, and the password must be the SMTP credential (`gmsmtp_…`), not an API key (`gm_…`).

**Connection timed out or the TLS handshake fails.** Check the host is `smtp.groundmail.dev`, the port is `587` and encryption is STARTTLS. If outbound port 587 is blocked where the app runs, use `2525` with the same settings.

**The message is rejected because of the From address.** The sender email must use a [verified domain](https://docs.groundmail.dev/domains) on your account. Until then you can only send from the sandbox sender, and only to your own account email.

**A recipient never receives the email.** The address may be on your suppression list, usually after a hard bounce. See [Suppressions](https://docs.groundmail.dev/suppressions), and create a [webhook](https://docs.groundmail.dev/webhooks) for `email.bounced` to get notified.

**Sends are deferred.** A new account has a daily ramp-up limit, and the Free plan has a daily limit. The relay replies with a temporary error and a retry time. See [Sending limits](https://docs.groundmail.dev/sending-limits).

---

## Related

- [SMTP relay](https://docs.groundmail.dev/smtp)
- [Testing](https://docs.groundmail.dev/testing)
- [Webhooks](https://docs.groundmail.dev/webhooks)
