=== Subset Mail ===
Contributors: functionform
Tags: smtp, email, mail, email log, wp_mail
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.2.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send WordPress email through SMTP or your email provider's API, with a log that won't bloat your database. No ads, no nags.

== Description ==

Subset Mail sends your site's email through SMTP or your email provider's API instead of PHP's `mail()`, and keeps a log of every message.

* **Fast.** The log lives in its own indexed table, and API mailers send in one HTTP request. A site that sends no email runs no extra queries.
* **Quiet.** No ads, upsells or nag notices. Failed sends show up in Site Health, not as admin notices.
* **Extensible.** Hooks and filters for every step, plus WP-CLI commands and a REST API.
* **Safe to remove.** Uninstalling keeps your settings and log unless you choose otherwise.

= Mailers =

* SMTP with TLS or SSL, for any provider or your own server.
* API mailers for Amazon SES, Postmark, Mailgun, SendGrid and Brevo. They send over HTTPS, so they work on hosts that block SMTP ports.
* Set a fixed From address and name, or only fill them in when a plugin leaves them blank.
* Every setting, including passwords and API keys, can be set in `wp-config.php` instead of the database. Settings set there show as locked on the settings screen.
* Send a test email from Subset > Mail, or with `wp subset mail test`.
* Stop all email from a staging or development copy with `define( 'SUBSET_MAIL_DISABLE', true );`. Blocked emails are still logged.

= Email log =

* Every email: recipients, subject, mailer, status, the error if it failed, and when it was sent.
* Message bodies aren't stored unless you turn that on. Attachments are listed by name and size, never stored.
* Entries older than 30 days are deleted daily, and so are the oldest entries beyond 50,000. Both limits are settings, and entries can be kept for up to 90 days.
* Search and filter by status, recipient and date. Resend an email when its body was stored.
* Personal data exports and erasure requests include the log, matched on the recipient's address.

= Site Health =

* A failed send in the last 24 hours shows as a Site Health issue, with the error and a link to the log.
* Checks that your sending domain has SPF and DMARC records, and says what's missing. The lookup runs only when you open Site Health.

= Import from another plugin =

Bring your mailer settings from WP Mail SMTP, FluentSMTP or Post SMTP. Their settings are read from the database, so the other plugin doesn't have to be active, and you see what will be imported before anything is saved.

= For developers =

* WP-CLI: `wp subset mail test`, `wp subset mail log list|get|resend|delete|prune` and `wp subset mail settings list|get|set|reset`.
* REST API under `subset-mail/v1`.
* Hooks for every step, documented with examples in the plugin's repository.
* Multisite: network activation sets up every site. The mailer and its connection are set once, under Network Admin > Settings > Subset Mail. The network sets a default From address, which each site can replace with its own. Each site keeps its own log.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/`, or install it from the Plugins screen.
2. Activate it.
3. Go to Subset > Mail, choose a mailer and send a test email.

== Frequently Asked Questions ==

= Where should I put my password or API key? =

In `wp-config.php` if you can, for example `define( 'SUBSET_MAIL_POSTMARK_TOKEN', '…' );`. Keys set there never touch the database, so they don't travel with a database export. Keys saved on the settings screen are encrypted in the database with a key derived from your site's auth salt. If you change your salts, enter your keys again.

= Does the log store the content of my emails? =

Not by default. It stores recipients, subject, status, the mailer used and any error. You can turn on body storage under Subset > Mail > Settings, for example while debugging, and turn it off again. Resending needs a stored body.

= Does the plugin contact any external services? =

Only the mail service you choose, and only to send email. It makes no other remote requests and collects no usage data.

= What happens if my mail service is down? =

The send fails, WordPress reports the failure to the plugin that sent the email, and the log records the error. A failure in the last 24 hours shows in Site Health. Subset Mail Pro is planned to retry through a backup connection.

= Will deleting the plugin delete my log? =

No. Deleting the plugin keeps your settings and log, so reinstalling it picks up where you left off. To remove everything when the plugin is deleted, turn on "Delete all data on uninstall" under Subset > Mail > Settings first. On multisite, each site decides for itself.

== Screenshots ==

1. Choosing a mailer, with settings locked by wp-config.php.
2. The email log, filtered to failed sends.
3. A failed send in Site Health.

== Changelog ==

= 0.2.3 =
* Security: The Subset menu and its Overview page now need the same capability as a Subset page you can open, so a subscriber no longer reaches the Overview.
* Changed: Built on subset-core 1.13.3.

= 0.2.2 =
* Security: Line breaks are now stripped from email header values and display names (Reply-To, From name, subject and the like) before the API mailers send them, so a crafted name can't add headers such as Bcc.
* Changed: Built on subset-core 1.13.2.

= 0.2.1 =
* Changed: Built on subset-core 1.11.2.

= 0.2.0 =
* Changed: Add-ons now hook `subset_mail_admin_tab_{slug}`; the old `subset_mail_admin_panel_{slug}` hook still works but is deprecated. With `WP_DEBUG` on, using it logs a deprecation notice.
* Changed: The `subset_mail_admin_enqueue` action now also passes the slug of the open tab.
* Under the hood: shares more code with the other Subset plugins.
* Changed: Built on subset-core 1.11.1.

= 0.1.0 =
* First release.
