# WordPress and WooCommerce email with Groundmail

Send WordPress email through Groundmail with the free [Groundmail plugin](https://wordpress.org/plugins/groundmail/) from the WordPress plugin directory, or by pointing an SMTP plugin such as WP Mail SMTP or FluentSMTP at the Groundmail SMTP relay. Either way it covers password resets, comment notifications and anything else your site sends with `wp_mail()`. For store emails, see [WooCommerce](#woocommerce).

---

## Prerequisites

- A Groundmail account with a [verified sending domain](https://docs.groundmail.dev/domains).
- For SMTP: 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).
- Admin access to the WordPress site.
- For the Groundmail plugin: an API key. In the Groundmail dashboard, open **API Keys** and create one; a send-only key is enough.
- For SMTP: WP Mail SMTP or FluentSMTP installed.

Everything WordPress sends through Groundmail goes out as transactional email, so use it for account, order and notification email. Send opt-in newsletters through the [API](https://docs.groundmail.dev/emails) with `category: "newsletter"` once your account is approved, and never send cold email.

---

## Option 1: the Groundmail plugin

The plugin sends over HTTPS with the Groundmail API, so it works on hosts that block SMTP ports.

1. In WordPress, go to **Plugins**, then **Add New**, search for **Groundmail**, then click **Install Now** and **Activate**.
2. Go to **Settings**, then **Groundmail**, and paste your API key. To keep the key out of the database, add it to `wp-config.php` instead:

```php
define( 'GROUNDMAIL_API_KEY', 'gm_your_key' );
```

3. Set **From email** to an address on your [verified domain](https://docs.groundmail.dev/domains), such as `wordpress@yourdomain.com`, and set **From name**. Turn on **Force From** if other plugins set their own sender.
4. Click **Save Changes**. The plugin checks the key with Groundmail when you save it.
5. Send a test email from the same page to `delivered@simulator.groundmail.dev`.

Until it has an API key the plugin does nothing, and WordPress sends email the way it did before. The optional send log on the settings page lists the last 50 emails with their result, never their content.

---

## Option 2: WP Mail SMTP

1. In WordPress, go to **WP Mail SMTP**, then **Settings**, and open the **General** tab.
2. Set **From Email** to an address on your verified domain, for example `wordpress@yourdomain.com`, and check **Force From Email** so every message uses it. The from address must be on a [verified domain](https://docs.groundmail.dev/domains).
3. Set **From Name** to your site or brand name.
4. Choose **Other SMTP** as the **Mailer**, then fill in:

| WP Mail SMTP field | Value |
|--------------------|-------|
| SMTP Host | `smtp.groundmail.dev` |
| Encryption | `TLS` |
| SMTP Port | `587` |
| Authentication | On |
| SMTP Username | `groundmail` |
| SMTP Password | Your SMTP credential (`gmsmtp_…`) |

5. Click **Save Settings**.

WP Mail SMTP describes port 587 as the TLS option. That is the STARTTLS connection Groundmail expects. Don't choose SSL or port 465.

---

## Option 3: FluentSMTP

1. In WordPress, go to **Settings**, then **FluentSMTP**. If you already have a connection, open **Settings** and choose **Add Another Connection**.
2. Select **Other SMTP** as the method.
3. Under sender settings, set **From Email** to an address on your verified domain and set **From Name**.
4. Under SMTP server settings, enter `smtp.groundmail.dev` as the host and `587` as the port, and choose STARTTLS (labelled TLS in most plugins) for encryption. Turn **Authentication** on, then enter `groundmail` as **SMTP Username** and your SMTP credential (`gmsmtp_…`) as **SMTP Password**.
5. Click **Save Connection Settings**.

FluentSMTP's documentation for this method names the sender and authentication fields but not the host, port and encryption fields, so match those to the labels you see. FluentSMTP stores credentials encrypted in the database by default (**Store Access Keys in DB**), or reads them from constants in `wp-config.php` if you choose **Access Keys in Config File**.

---

## Test it

Groundmail's simulator addresses work over SMTP and never reach a real inbox. In WP Mail SMTP, go to **WP Mail SMTP**, then **Tools**, and open the **Email Test** tab. Enter this in **Send To** and click **Send Email**:

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

WP Mail SMTP shows a success message when the server accepts the message. 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). Finally, send a test to your own address to check how it lands in a real inbox.

---

## WooCommerce {#woocommerce}

WooCommerce sends order and account emails with `wp_mail()`, so once the Groundmail plugin or your SMTP plugin is connected as above, every WooCommerce email goes through Groundmail.

**Match the sender.** Go to **WooCommerce**, then **Settings**, then **Emails**, and set the **"From" address** to an address on your verified domain, such as `orders@yourdomain.com`. WooCommerce's documentation recommends an address that matches your site's domain, and Groundmail requires it to be on a [verified domain](https://docs.groundmail.dev/domains). If your SMTP plugin has **Force From Email** on, use the same address there so the two don't disagree.

**Test with a real order email, without emailing a customer.** Create a test order in the WooCommerce admin with the billing email `delivered@simulator.groundmail.dev` and change its status to **Completed**. If the customer's "Completed order" email is enabled under **WooCommerce**, **Settings**, **Emails**, WooCommerce sends it through Groundmail, and it shows up under **Emails** in the Groundmail dashboard. Use `bounce@simulator.groundmail.dev` as the billing email to see a hard bounce. Delete the test orders afterwards.

**Watch delivery.** SMTP gives the plugin only the hand-off result. To know whether an order email was delivered, bounced or marked as spam, create a [webhook](https://docs.groundmail.dev/webhooks) for `email.delivered`, `email.bounced` and `email.complained`, or check the **Emails** page in the dashboard.

**WooCommerce emails don't arrive but the plugin test works.** Check the WooCommerce **"From" address** is on your verified domain, and that the specific email is enabled under **WooCommerce**, **Settings**, **Emails**.

---

## Troubleshooting

**Authentication failed.** The username must be exactly `groundmail`, and the password must be the SMTP credential (`gmsmtp_…`), not an API key (`gm_…`). Create a new credential in the dashboard under **SMTP** if you lost it.

**Connection timed out or refused.** Check the host is `smtp.groundmail.dev`, the port is `587` and encryption is TLS, not SSL. Some hosts block outgoing SMTP connections; ask your host to allow port 587 if the test fails to connect.

**The message is rejected because of the From address.** The From 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. Turn on **Force From Email** if another plugin overrides the sender.

**A recipient never receives the email.** The address may be on your suppression list, usually after a hard bounce. List suppressions with `GET /suppressions` (needs a full-access API key) and see [Suppressions](https://docs.groundmail.dev/suppressions). To get notified about bounces, create a [webhook](https://docs.groundmail.dev/webhooks).

**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, and your site's SMTP client keeps trying. See [Sending limits](https://docs.groundmail.dev/sending-limits).

---

## Other ecommerce platforms

Running a store on something other than WooCommerce? These guides cover the same setup, from the sender address to a test order:

- [Magento and Adobe Commerce](https://docs.groundmail.dev/integrations/magento)
- [PrestaShop](https://docs.groundmail.dev/integrations/prestashop)
- [OpenCart](https://docs.groundmail.dev/integrations/opencart)
- [Shopware](https://docs.groundmail.dev/integrations/shopware)
- [Sylius](https://docs.groundmail.dev/integrations/sylius)
- [Drupal Commerce](https://docs.groundmail.dev/integrations/drupal#drupal-commerce)
- [Vendure](https://docs.groundmail.dev/integrations/vendure)
- [Saleor](https://docs.groundmail.dev/integrations/saleor)
- [BigCommerce](https://docs.groundmail.dev/integrations/bigcommerce)
- [nopCommerce](https://docs.groundmail.dev/integrations/nopcommerce)

---

## Related

- [SMTP relay](https://docs.groundmail.dev/smtp)
- [Other tools with SMTP settings](https://docs.groundmail.dev/smtp/tools)
- [Testing](https://docs.groundmail.dev/testing)
- [Webhooks](https://docs.groundmail.dev/webhooks)
- [Errors](https://docs.groundmail.dev/errors)
