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

> ## Agent Instructions
> AhaSend stores all message data in the EU. See /facts.
> The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.
> Use send.ahasend.com for SMTP in the EU, or send-us.ahasend.com as a US connection point forwarding to the EU. Ports 25, 587 and 2525 use STARTTLS. Port 465 is not supported. See /smtp.
> For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes.

# Send WordPress Email with the API Plugin

> Set up the AhaSend WordPress email plugin with a legacy API v1 sandbox key, test wp_mail, check plugin limits and prepare your site for live mail.

AhaSend's WordPress plugin sends WordPress mail through the HTTP API; this guide configures the existing plugin and tests `wp_mail` in sandbox mode.

## Prerequisites

Use a staging WordPress site, a [verified sending domain](/docs/domains), admin access and a **Sandbox API v1 credential** from the AhaSend Credentials page. Plugin 1.3 calls the [legacy v1 endpoint](/docs/api-reference/v1); an API v2 key will not work. Use [SMTP credentials](/docs/smtp/credentials) if you instead choose a general WordPress SMTP plugin.

The [WordPress plugin listing](https://wordpress.org/plugins/ahasend-email-api/) gives current compatibility information. Version 1.3 uses a must-use plugin to replace `wp_mail`; test your site's other mail plugins for conflicts before changing production settings.

## Install and Configure the Plugin

1. In WordPress, go to **Plugins → Add New Plugin** and search for **AhaSend Email API**. Install and activate the plugin published by AhaSend.
2. Open **AhaSend Email** in the main admin menu (`admin.php?page=ahasend-email-api`). Fill in **API Key**, **From Email** and **From Name**. The sender must use your verified domain. Save the settings.
3. Visit an admin page after activation so the plugin can create `wp-content/mu-plugins/ahasend-mu-mailer.php`. The server must be allowed to write to that directory.
4. Confirm the saved key is a sandbox v1 credential. This plugin has no request-level sandbox switch.

For a short test, save the following as `ahasend-test.php` outside the public web directory. With [WP-CLI](https://developer.wordpress.org/cli/commands/eval-file/) installed, run `wp eval-file /path/to/ahasend-test.php` from your WordPress root.

```php ahasend-test.php theme={null}
<?php
$accepted = wp_mail('recipient@example.com', 'WordPress sandbox test', 'Hello from AhaSend');
if (!$accepted) {
    WP_CLI::error('Email was not accepted; check the AhaSend settings.');
}
WP_CLI::success('Accepted by the API; check the AhaSend sandbox log.');
```

The script exits with an error when `wp_mail` returns false. The plugin treats a successful HTTP response as success; check the corresponding message in AhaSend before treating the integration as working.

## Prepare the Production Site

Keep the sandbox key on staging. After testing, create a separate domain-restricted v1 production credential and save it on the live site only. Limit access to plugin settings and WordPress database backups, which contain the saved key. Review [key security](/docs/security).

Trigger the real workflows your site needs, such as password resets and purchase receipts. The 1.3 replacement handles simple recipients, subject and message content; it does not forward every `wp_mail` header or its attachment argument. Do not assume CC, BCC or attachments work through this plugin. Keep those workflows on a tested [SMTP integration](/docs/smtp/php) if needed.

Use an application job record to avoid duplicate receipts if a request times out, and check [delivery events](/docs/integrations/webhooks) after API acceptance. When replacing this plugin, deactivate it normally and confirm its must-use mailer file was removed; deleting only the main plugin folder can leave the mail override behind.

## Why Does a WordPress SMTP Search Lead Here?

The AhaSend plugin uses HTTPS, so it can work on hosts that block outbound SMTP. If your existing plugin accepts a custom SMTP server, use the [AhaSend SMTP settings](/docs/smtp) with a separate SMTP credential. Do not put an API key into its password field.

## Related Guides

* [Verify a domain](/docs/domains), [sandbox mode](/docs/send-api/sandbox), [legacy API v1](/docs/api-reference/v1) and [v1 versus v2](/docs/api-reference/v1/v1-vs-v2).
* [SMTP settings](/docs/smtp), [PHP SMTP](/docs/smtp/php), [REST API](/docs/send-api/send-email), [CLI quickstart](/docs/cli/quickstart) and [Node.js SDK](/docs/guides/nodejs-sdk).
* [Troubleshooting](/docs/troubleshooting), [security](/docs/security) and [delivery webhooks](/docs/integrations/webhooks).
