=== Reply-To for WP_Mail ===
Contributors: robotstxt, javiercasares
Tags: email, reply-to, mail, smtp
Requires at least: 4.7
Tested up to: 7.2
Stable tag: 2.1.2
Requires PHP: 5.6
Version: 2.1.2
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.txt

Configure different "Reply-To" addresses by email context with validation, modern tabbed UI, and automatic migration.

== Description ==

The Reply-To for WP_Mail plugin allows you to easily manage the "Reply-To" header for all emails sent from your WordPress site. With this plugin, you can specify a custom email address that recipients will use when replying to your site's emails, ensuring that responses go to the correct inbox.

Configure a different Reply-To address for each type of email: password resets, comment notifications, user registrations, system updates, and WooCommerce orders.

Two developer filters are available for advanced customization:

* `wp_mail_replyto_context` — override the detected email context.
* `wp_mail_replyto_header` — override or suppress the Reply-To header for a specific email.

== Installation ==

= Automatic download =

Visit the plugin section in your WordPress admin, search for "Reply-To for WP Mail"; download and install the plugin.

= Manual download =

Extract the contents of the ZIP and upload the contents to the `/wp-content/plugins/replyto/` directory. Once uploaded, it will appear in your plugin list.

== Frequently Asked Questions ==

= Will my existing Reply-To setting be preserved after upgrading from v1? =

Yes. The plugin automatically migrates your existing email address and name to the Default context on the first page load after upgrade.

= What happens if I configure a context but leave it disabled? =

Disabled contexts fall back to the Default Reply-To. If no Default is configured, no Reply-To header is added.

= Does this plugin work with WooCommerce? =

Yes. When WooCommerce is active, a dedicated WooCommerce tab appears so you can route order emails to a separate reply address.

= Will my settings be deleted when I uninstall the plugin? =

No. By default all plugin data is preserved on uninstall. If you want everything removed, check "Delete plugin data on uninstall" on the Default tab before uninstalling. On Multisite, each site's own setting decides for that site's data.

= Does this plugin work on WordPress Multisite? =

Yes. Each site in a Multisite network maintains its own configuration. On uninstall, each site's data is removed only if that site opted in to data deletion; by default all data is preserved.

== Compatibility ==

* WordPress: 4.7 - 7.2
* PHP: 5.6 - 8.6

== Changelog ==

= 2.1.2 =

_Release date: 2026-11-03_

**Highlights**

* Legacy v1 options no longer wiped on save, and WordPress 7.2 / PHP 8.6 compatibility declared and verified.

**Fixed**

* Legacy v1.0.x Reply-To options (wp_mail_replyto_email, wp_mail_replyto_name) were emptied on every settings save, destroying the rollback/migration fallback values; on PHP 8.1+ hosts the same code path logged a sanitize_email() deprecation (found in debug.log review). The options are no longer part of the Settings API group, so their values survive every save.

**Changed**

* Development tooling updated via composer update (PHPStan 2.2.14 → 2.3.5, wp-compat 2.0.1 → 3.0.1, wordpress-stubs 7.1.0 → 7.1.2, PHPUnit 9.6.36 → 9.6.38).
* PHPCompatibility 9.3.5 → 10.0.0-alpha2 (dev-only): the 9.x line cannot see PHP 8.x syntax, 10.x scans through 8.6 for real.

**Compatibility**

* WordPress: 4.7 - 7.2 (Tested up to raised to 7.2 after smoke tests on WordPress 7.2-beta4 single-site staging: settings render, save, and wp_mail Reply-To injection verified)
* PHP: 5.6 - 8.6 (PHPCompatibility scan 5.6-8.6 clean; runtime verified on PHP 7.4, 8.2, 8.3, 8.4, 8.5, and 8.6.0RC3; syntax lint passes on every PHP binary 5.6 through 8.6)

**Tests**

* PHP Coding Standards: 3.13.6
* WordPress Coding Standards: 3.4.1
* PHPCompatibility: 10.0.0-alpha2 (range 5.6-8.6)
* PHPStan: 2.3.5 (level 9, wp-compat 3.0.1 enforcing the WordPress 4.7 floor)
* PHPUnit: 9.6.38 (87 tests)
* Plugin Check (PCP): 0 errors on the release package (4 accepted warnings, unchanged)

= 2.1.1 =

_Release date: 2026-09-18_

**Highlights**

* Security hardening patch: settings error messages now escape the context label, and the deferred review items are closed out. No behavior change.

**Security**

* Context name in settings error/warning messages now escaped at output time (defense in depth for translated labels).

**Changed**

* Known-issues triage closed: load_plugin_textdomain() accepted (bundled translations must load), trademarked_term accepted (not a problem), switch_to_blog() uninstall sweep confirmed as the standard pattern (batched get_sites() documented as the fallback for very large networks).
* composer update re-run: no dependency changes (already current).

**Compatibility**

* WordPress: 4.7 - 7.1 (7.2 not yet released — expected December 2026 — so Tested up to stays at 7.1)
* PHP: 5.6 - 8.5

**Tests**

* PHP Coding Standards: 3.13.6
* WordPress Coding Standards: 3.4.1
* PHPStan: 2.2.14 (level 9)
* PHPUnit: 9.6.36

= 2.1.0 =

_Release date: 2026-09-18_

**Highlights**

* Known issues resolved: WooCommerce context values are no longer lost, and plugin data is now preserved on uninstall unless you opt in to removal.

**Added**

* "Delete plugin data on uninstall" opt-in setting (Default tab). Your Reply-To settings are preserved by default and only removed when you explicitly check this box.
* WP_MAIL_REPLYTO_VERSION constant for cache-busting and version checks.

**Changed**

* WooCommerce context values now survive settings saves made while WooCommerce is deactivated (previously they were silently dropped; the tab reappears with its values when WooCommerce is reactivated).
* Settings page now terminates with wp_die() instead of a silent blank page when accessed without manage_options.
* "Save Settings" button no longer double-escaped.
* Active tab query parameter ($_GET['tab']) now unslashed before sanitization (Plugin Check hardening).
* Development tooling updated via composer update (PHPStan 2.2.8 → 2.2.14, wp-compat 1.5.0 → 2.0.1, wordpress-stubs 6.9.4 → 7.1.0, phpstan-wordpress 2.0.3 → 2.0.4, php-parser 5.8.0 → 5.9.0, wp-hooks/wordpress-core 1.12.0 → 1.13.0).
* Documented wp-compat 2.x false positive for apply_filters() extra args (formalized in the 6.0 signature, functional since WP 0.71) with a targeted phpstan.neon ignore.
* bin/preflight.sh runs PHPStan with --memory-limit=1G (updated dev deps exceed the default 512M worker limit).

**Compatibility**

* WordPress: 4.7 - 7.1 (7.2 not yet released — expected December 2026 — so Tested up to stays at 7.1)
* PHP: 5.6 - 8.5

**Tests**

* PHP Coding Standards: 3.13.6
* WordPress Coding Standards: 3.4.1
* PHPStan: 2.2.14 (level 9)
* PHPUnit: 9.6.36
* Plugin Check (PCP): 0 errors on the release package.

= Previous versions =

If you want to see the full changelog, visit the [changelog](https://www.robotstxt.software/plugins/replyto/changelog/) page.

== Upgrade Notice ==

= 2.1.2 =

Legacy v1 settings are no longer wiped on save; tested with WordPress 7.2 and PHP 8.6. Recommended for everyone.

= 2.1.1 =
Security hardening patch: settings messages escape the context label. No behavior change; upgrade optional.

= 2.1.0 =
WooCommerce context values are preserved and plugin data is kept on uninstall unless you opt in. Recommended for all users.

== Compliance ==

This plugin adheres to the following security measures and review protocols for each version:

* [WordPress Plugin Handbook](https://developer.wordpress.org/plugins/)
* [WordPress Plugin Security](https://developer.wordpress.org/plugins/wordpress-org/plugin-security/)
* [WordPress APIs Security](https://developer.wordpress.org/apis/security/)
* [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards)
* [Plugin Check (PCP)](https://wordpress.org/plugins/plugin-check/)
