=== AgentiSend ===
Contributors: agentisend
Tags: email, woocommerce, transactional
Requires at least: 5.7
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send WordPress and WooCommerce email through AgentiSend.

== Description ==

AgentiSend sends the email WordPress already creates. Core mail, WooCommerce mail, and any other plugin that calls `wp_mail` are posted to the AgentiSend API. There is no SMTP host to enter.

You save an API key and a From address. The plugin checks both before it keeps them: the key has to be accepted, and the From domain has to be verified. Until a key is saved, the plugin does not contact AgentiSend, and WordPress sends mail the way it did before.

A refused message stays in the recent list with the code and the fix AgentiSend returned. Retry posts that message again. A second attempt of a message that already succeeded does not send a second copy.

== Installation ==

1. Download https://agentisend.com/downloads/agentisend-wordpress-1.0.0.zip (the current version is also at https://agentisend.com/downloads/agentisend-wordpress.zip). Upload it under Plugins → Add New → Upload Plugin, or copy the `agentisend` folder into `wp-content/plugins/`.
2. Activate AgentiSend.
3. Open Settings → AgentiSend.
4. Paste an API key (create one with `POST /api-keys`) and the From name and address on a domain you have verified.
5. Save. If the key or the domain is refused, the message on the screen is the fix from AgentiSend, and the previous values stay in place.

WooCommerce is not required. When it is installed, its emails go out through the same hook.

== Frequently Asked Questions ==

= Does this plugin send anything before I save a key? =

No. Activation does not call AgentiSend. The settings screen does not call AgentiSend until you save a key. With no key saved, `wp_mail` is unchanged.

= What is checked when I press Save? =

The plugin calls `GET /domains` with the key. The From domain must be on that list with status verified (or partially verified) and sending enabled. A key that cannot list domains is checked with `POST /emails/preflight` instead, which does not send. A bad key or an unverified domain is not saved.

= How do I send a test? =

Settings → AgentiSend → Send to simulator sends one email to `delivered@simulator.agentisend.com`. Send to the admin address sends one email to the address in Settings → General. Both are real requests. The result is the message id, or the code and the fix.

= A send failed. How do I retry? =

The recent list shows the code and the fix. Retry on that row posts the same message again. The lock from the failed attempt is removed first, so the retry is not blocked by it. If the first attempt had actually succeeded, the retry returns the same message id and does not send a second copy.

= Can WordPress send the message itself when AgentiSend refuses it? =

Yes, if you turn on "If AgentiSend refuses a message, send it with the site mailer instead." It is off by default. A refusal still shows in the recent list.

== Changelog ==

= 1.0.0 =
* First release. WordPress mail is posted to POST /emails.

== External Services ==

This plugin connects to AgentiSend (https://agentisend.com) only after you save an API key. It does not connect on activation, and it does not connect while the key field is empty.

Service: AgentiSend, https://api.agentisend.com

When you save settings, the plugin sends the API key to `GET https://api.agentisend.com/domains` and reads the domain list, so it can refuse a key that does not work or a From address on a domain that is not verified. If the key is not allowed to list domains, the plugin instead sends the From address, the subject "Domain check", the text "This check does not send.", and the recipient domain-check@example.com to `POST https://api.agentisend.com/emails/preflight`. That call does not send email.

When WordPress sends mail (including WooCommerce), and when you press either test button or Retry, the plugin sends the message to `POST https://api.agentisend.com/emails`. The body contains the From address, the To, Cc and Bcc recipients, Reply-To, the subject, the HTML or text body, the headers WordPress passed that the API accepts (In-Reply-To, References, List-Unsubscribe, List-Unsubscribe-Post, Message-ID), and file attachments as base64. The request also sends an Idempotency-Key header, a hash of that message, so a retry does not create a second copy.

The API key is sent on every one of those calls as a bearer token. It is stored in the WordPress options table on this site.

Terms of service: https://agentisend.com/terms
Privacy policy: https://agentisend.com/privacy
