From c73e6b6e58b05d9f0380ed8be1a97a976cb7144a Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Fri, 5 Jun 2026 11:32:24 +0000 Subject: [PATCH] v2.0.2 --- changelog.txt | 186 +++++++++++++++ languages/replyto-ca.mo | Bin 0 -> 6266 bytes languages/replyto-ca.po | 215 ++++++++++++++++++ languages/replyto-es_ES.mo | Bin 0 -> 6403 bytes languages/replyto-es_ES.po | 215 ++++++++++++++++++ languages/replyto.pot | 242 +++++++++----------- languages/wp-mail-replyto.pot | 68 ------ readme.txt | 196 ++++++++++------ replyto.php | 412 ++++++++++++++++++---------------- 9 files changed, 1068 insertions(+), 466 deletions(-) create mode 100644 changelog.txt create mode 100644 languages/replyto-ca.mo create mode 100644 languages/replyto-ca.po create mode 100644 languages/replyto-es_ES.mo create mode 100644 languages/replyto-es_ES.po delete mode 100644 languages/wp-mail-replyto.pot diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..27a6fa1 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,186 @@ +== Changelog == + += 2.0.2 = + +_Release date: 2026-06-05_ + +**Highlights** + +* Translations added for Spanish (Spain) and Catalan. +* WordPress minimum version corrected to 3.6 based on actual function usage. + +**Changed** + +* Minimum WordPress version updated from 4.1 to 3.6 (real minimum per wp-compat analysis: wp_unslash since WP 3.6). +* Tested up to WordPress 7.1. +* POT file regenerated via WP-CLI i18n — removed dead strings, corrected line references. +* Deploy script no longer includes docs/ in the distributable ZIP. +* Deploy script skips empty vendor/ directory when no production Composer dependencies exist. + +**Added** + +* Spanish (Spain) translation (es_ES). +* Catalan translation (ca). + +**Compatibility** + +* WordPress: 3.6 - 7.1 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHP Coding Standards: 3.13.5 +* WordPress Coding Standards: 3.3.0 +* PHPStan: 2.2.2 (level 9) +* PHPUnit: 9.6.34 + += 2.0.1 = + +_Release date: 2026-06-05_ + +**Highlights** + +* Major bugfix release addressing three critical issues found during pre-deploy audit. + +**Fixed** + +* Context cache not resetting between emails in the same PHP process (affected WP-Cron and REST batch sends). +* Duplicate Reply-To header injected when an existing Reply-To was present in the email. +* Migration hook only running on admin_init — missed WP-CLI activations and automated deployments. +* RFC 5322 display name quoting now applied only when the name contains special characters. + +**Added** + +* Developer filter wp_mail_replyto_context — override the detected email context. +* Developer filter wp_mail_replyto_header — override or suppress the Reply-To header per email. +* load_plugin_textdomain() registration for translation support on WordPress < 4.6. +* DNS domain validation per context with user-friendly warning messages. +* PHPUnit test suite (27 tests). +* bin/deploy.sh build script. + +**Changed** + +* Admin CSS now registered via wp_register_style() + wp_add_inline_style(). +* enabled flag now handles boolean true in addition to string '1'. +* Multibyte-safe name length truncation (mb_strlen/mb_substr). +* CR-only header normalization added alongside CRLF. + +**Security** + +* sanitize_callback added to legacy option registrations (wp_mail_replyto_email, wp_mail_replyto_name). + +**Compatibility** + +* WordPress: 4.1 - 6.9 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHP Coding Standards: 3.13.5 +* WordPress Coding Standards: 3.3.0 +* PHPStan: 2.2.2 (level 9) +* PHPUnit: 9.6.34 + += 2.0.0 = + +_Release date: 2026-01-20_ + +**Highlights** + +* Complete rewrite with context-based Reply-To routing. + +**Added** + +* Context-based Reply-To routing — configure different Reply-To addresses for different types of emails. +* Six email contexts: Default, Authentication & Security, Comments & Moderation, Users & Registration, System & Updates, WooCommerce. +* WooCommerce tab only shown when WooCommerce plugin is active. +* Intelligent context detection using debug_backtrace() with DEBUG_BACKTRACE_IGNORE_ARGS and a 20-frame limit. +* Modern tabbed admin interface using WordPress native nav-tab-wrapper. +* Visual status indicators on each tab. +* Enable/disable toggle per context (Default is always active). +* Fallback chain: specific context → Default context → legacy settings. +* Reply-To display name field with header injection prevention. +* DNS domain validation for email addresses. +* Configuration change logging for security auditing (requires WP_DEBUG_LOG). +* Automatic migration from v1.0.x — existing settings preserved in the Default context. +* uninstall.php for clean removal of all plugin options on single-site and Multisite. + +**Changed** + +* Settings structure changed from two individual options to a single serialized array (wp_mail_replyto_contexts). +* Settings page completely rewritten with tab-based interface. + +**Security** + +* Strict RFC 5322 email format validation beyond is_email(). +* Defense-in-depth header injection prevention. + +**Compatibility** + +* WordPress: 4.1 - 6.9 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHP Coding Standards: 3.13.4 +* WordPress Coding Standards: 3.3.0 +* Plugin Check (PCP): 1.4.0 + += 1.0.3 = + +_Release date: 2025-04-08_ + +**Changed** + +* Compatible with WordPress 6.8. +* Improved function documentation. + +**Compatibility** + +* WordPress: 4.1 - 6.9 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHP Coding Standards: 3.12.1 +* WordPress Coding Standards: 3.1.0 +* Plugin Check (PCP): 1.4.0 + += 1.0.2 = + +_Release date: 2024-11-02_ + +**Fixed** + +* Preparation for GlotPress translation workflow. + +**Compatibility** + +* WordPress: 4.1 - 6.9 +* PHP: 5.6 - 8.5 + += 1.0.1 = + +_Release date: 2024-10-31_ + +**Added** + +* Translation ready. + +**Compatibility** + +* WordPress: 4.1 - 6.9 +* PHP: 5.6 - 8.5 + += 1.0.0 = + +_Release date: 2024-10-22_ + +**Added** + +* First version. + +**Compatibility** + +* WordPress: 4.1 - 4.1 +* PHP: 5.6 - 8.5 diff --git a/languages/replyto-ca.mo b/languages/replyto-ca.mo new file mode 100644 index 0000000000000000000000000000000000000000..f7b29a9fb8ce372885a12c73748ea6968f75349e GIT binary patch literal 6266 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 VQ+*v_m0sV5#vgv#Hhf=~|6k$XyORI_ literal 0 HcmV?d00001 diff --git a/languages/replyto-ca.po b/languages/replyto-ca.po new file mode 100644 index 0000000..7985dee --- /dev/null +++ b/languages/replyto-ca.po @@ -0,0 +1,215 @@ +# Translation of Reply-To for WP_Mail in Catalan +# Copyright (C) 2026 ROBOTSTXT +# This file is distributed under the GPL-3.0-or-later. +msgid "" +msgstr "" +"Project-Id-Version: Reply-To for WP_Mail 2.0.2\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/replyto\n" +"POT-Creation-Date: 2026-06-05T11:22:01+00:00\n" +"PO-Revision-Date: 2026-06-05 12:00+0100\n" +"Last-Translator: Javier Casares \n" +"Language-Team: Catalan \n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Manual\n" +"X-Domain: replyto\n" + +#. Plugin Name of the plugin +#: replyto.php +msgid "Reply-To for WP_Mail" +msgstr "Respon-A per a WP_Mail" + +#. Description of the plugin +#: replyto.php +msgid "Configure your \"Reply-To:\" for WP_Mail with validation, admin settings, and context-based routing." +msgstr "Configureu el vostre «Respon-A:» per a WP_Mail amb validació, opcions d'administració i enrutament per context." + +#. Author of the plugin +#: replyto.php +msgid "ROBOTSTXT" +msgstr "ROBOTSTXT" + +#. Author URI of the plugin +#: replyto.php +msgid "https://www.robotstxt.es/" +msgstr "https://www.robotstxt.es/" + +#: replyto.php:391 +msgid "WP Mail Reply-To Settings" +msgstr "Configuració de Respon-A per a WP Mail" + +#: replyto.php:392 +msgid "Reply-To" +msgstr "Respon-A" + +#: replyto.php:492 +#: replyto.php:706 +msgid "Default" +msgstr "Predeterminat" + +#: replyto.php:493 +msgid "Authentication" +msgstr "Autenticació" + +#: replyto.php:494 +msgid "Comments" +msgstr "Comentaris" + +#: replyto.php:495 +msgid "Users" +msgstr "Usuaris" + +#: replyto.php:496 +msgid "System" +msgstr "Sistema" + +#: replyto.php:501 +#: replyto.php:735 +msgid "WooCommerce" +msgstr "WooCommerce" + +#. translators: %s: context name +#: replyto.php:526 +#, php-format +msgid "Invalid email address for %s context." +msgstr "Adreça de correu no vàlida per al context %s." + +#. translators: %s: context name +#: replyto.php:542 +#, php-format +msgid "Warning: The email domain for %s context does not appear to have valid DNS records." +msgstr "Avís: el domini de correu del context %s no sembla tenir registres DNS vàlids." + +#. translators: %s: context name +#: replyto.php:557 +#: replyto.php:567 +#, php-format +msgid "Name for %s context was truncated to 255 characters." +msgstr "El nom del context %s s'ha truncat a 255 caràcters." + +#: replyto.php:608 +msgid "Reply-To configuration updated successfully." +msgstr "La configuració de Respon-A s'ha actualitzat correctament." + +#: replyto.php:707 +msgid "Default Reply-To used for all emails that do not match a specific context. This is the fallback when other contexts are not configured." +msgstr "Respon-A predeterminat per a tots els correus que no coincideixin amb cap context específic. És l'opció de reserva quan altres contextos no estan configurats." + +#: replyto.php:708 +msgid "Newsletter confirmations, general notifications, and any emails not covered by other contexts." +msgstr "Confirmacions de butlletins, notificacions generals i qualsevol correu no cobert per altres contextos." + +#: replyto.php:711 +msgid "Authentication & Security" +msgstr "Autenticació i seguretat" + +#: replyto.php:712 +msgid "Reply-To for password resets, password changes, and email address changes." +msgstr "Respon-A per a restabliments de contrasenya, canvis de contrasenya i canvis de l'adreça de correu." + +#: replyto.php:713 +msgid "Password reset requests, password change confirmations, email address verifications." +msgstr "Sol·licituds de restabliment de contrasenya, confirmacions de canvi de contrasenya, verificacions de l'adreça de correu." + +#: replyto.php:716 +msgid "Comments & Moderation" +msgstr "Comentaris i moderació" + +#: replyto.php:717 +msgid "Reply-To for comment notifications and moderation alerts." +msgstr "Respon-A per a notificacions de comentaris i alertes de moderació." + +#: replyto.php:718 +msgid "New comment notifications, comment moderation alerts, comment replies." +msgstr "Notificacions de nous comentaris, alertes de moderació de comentaris, respostes a comentaris." + +#: replyto.php:721 +msgid "Users & Registration" +msgstr "Usuaris i registre" + +#: replyto.php:722 +msgid "Reply-To for new user registrations, role changes, and user management emails." +msgstr "Respon-A per a registres de nous usuaris, canvis de rol i correus de gestió d'usuaris." + +#: replyto.php:723 +msgid "New user welcome emails, user role changes, account activations." +msgstr "Correus de benvinguda a nous usuaris, canvis de rol d'usuari, activacions de compte." + +#: replyto.php:726 +msgid "System & Updates" +msgstr "Sistema i actualitzacions" + +#: replyto.php:727 +msgid "Reply-To for automatic updates, system alerts, and critical site health notifications." +msgstr "Respon-A per a actualitzacions automàtiques, alertes del sistema i notificacions crítiques de salut del lloc." + +#: replyto.php:728 +msgid "WordPress core updates, plugin updates, theme updates, recovery mode, fatal error notifications." +msgstr "Actualitzacions del nucli de WordPress, actualitzacions de connectors, actualitzacions de temes, mode de recuperació, notificacions d'errors fatals." + +#: replyto.php:736 +msgid "Reply-To for WooCommerce order notifications, invoices, and customer communications." +msgstr "Respon-A per a notificacions de comandes de WooCommerce, factures i comunicacions amb clients." + +#: replyto.php:737 +msgid "Order confirmations, shipping notifications, invoices, customer notes." +msgstr "Confirmacions de comandes, notificacions d'enviament, factures, notes del client." + +#: replyto.php:751 +msgid "Configure different Reply-To addresses based on the type of email being sent. Each context can have its own email address and display name." +msgstr "Configureu adreces de resposta diferents en funció del tipus de correu enviat. Cada context pot tenir la seva pròpia adreça de correu electrònic i nom." + +#: replyto.php:789 +msgid "Active with email configured" +msgstr "Actiu amb correu configurat" + +#: replyto.php:790 +msgid "Inactive or no email configured" +msgstr "Inactiu o sense correu configurat" + +#: replyto.php:806 +msgid "What this context covers:" +msgstr "Què cobreix aquest context:" + +#: replyto.php:808 +msgid "Examples:" +msgstr "Exemples:" + +#: replyto.php:819 +msgid "Enable this context" +msgstr "Activar aquest context" + +#: replyto.php:822 +msgid "When disabled, emails in this context will use the Default Reply-To address." +msgstr "Quan està desactivat, els correus d'aquest context usaran l'adreça de Respon-A predeterminada." + +#: replyto.php:832 +msgid "Reply-To Email Address" +msgstr "Adreça de correu de resposta" + +#: replyto.php:842 +msgid "Enter the email address where replies should be sent." +msgstr "Introduïu l'adreça de correu a la qual s'enviaran les respostes." + +#: replyto.php:849 +msgid "Reply-To Display Name (Optional)" +msgstr "Nom de visualització de resposta (opcional)" + +#: replyto.php:859 +msgid "Optional: Enter a name to display with the email (e.g., \"Support Team\")." +msgstr "Opcional: introduïu un nom per mostrar amb el correu (p. ex., «Equip de suport»)." + +#: replyto.php:868 +msgid "Note:" +msgstr "Nota:" + +#: replyto.php:869 +msgid "The Default context is always active and acts as a fallback for all emails." +msgstr "El context predeterminat sempre està actiu i actua com a reserva per a tots els correus." + +#: replyto.php:895 +msgid "Save Settings" +msgstr "Desa la configuració" diff --git a/languages/replyto-es_ES.mo b/languages/replyto-es_ES.mo new file mode 100644 index 0000000000000000000000000000000000000000..b4c51667386f0cb69ab49be97b184262b923df70 GIT binary patch literal 6403 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 V-S|%q$ku;=NTZ#65A6Hg_%Bx1`YQkc literal 0 HcmV?d00001 diff --git a/languages/replyto-es_ES.po b/languages/replyto-es_ES.po new file mode 100644 index 0000000..3118f2c --- /dev/null +++ b/languages/replyto-es_ES.po @@ -0,0 +1,215 @@ +# Translation of Reply-To for WP_Mail in Spanish (Spain) +# Copyright (C) 2026 ROBOTSTXT +# This file is distributed under the GPL-3.0-or-later. +msgid "" +msgstr "" +"Project-Id-Version: Reply-To for WP_Mail 2.0.2\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/replyto\n" +"POT-Creation-Date: 2026-06-05T11:22:01+00:00\n" +"PO-Revision-Date: 2026-06-05 12:00+0100\n" +"Last-Translator: Javier Casares \n" +"Language-Team: Spanish (Spain) \n" +"Language: es_ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Manual\n" +"X-Domain: replyto\n" + +#. Plugin Name of the plugin +#: replyto.php +msgid "Reply-To for WP_Mail" +msgstr "Responder a para WP_Mail" + +#. Description of the plugin +#: replyto.php +msgid "Configure your \"Reply-To:\" for WP_Mail with validation, admin settings, and context-based routing." +msgstr "Configure su «Responder a:» para WP_Mail con validación, ajustes de administración y enrutamiento por contexto." + +#. Author of the plugin +#: replyto.php +msgid "ROBOTSTXT" +msgstr "ROBOTSTXT" + +#. Author URI of the plugin +#: replyto.php +msgid "https://www.robotstxt.es/" +msgstr "https://www.robotstxt.es/" + +#: replyto.php:391 +msgid "WP Mail Reply-To Settings" +msgstr "Ajustes de Responder a para WP Mail" + +#: replyto.php:392 +msgid "Reply-To" +msgstr "Responder a" + +#: replyto.php:492 +#: replyto.php:706 +msgid "Default" +msgstr "Predeterminado" + +#: replyto.php:493 +msgid "Authentication" +msgstr "Autenticación" + +#: replyto.php:494 +msgid "Comments" +msgstr "Comentarios" + +#: replyto.php:495 +msgid "Users" +msgstr "Usuarios" + +#: replyto.php:496 +msgid "System" +msgstr "Sistema" + +#: replyto.php:501 +#: replyto.php:735 +msgid "WooCommerce" +msgstr "WooCommerce" + +#. translators: %s: context name +#: replyto.php:526 +#, php-format +msgid "Invalid email address for %s context." +msgstr "Dirección de correo no válida para el contexto %s." + +#. translators: %s: context name +#: replyto.php:542 +#, php-format +msgid "Warning: The email domain for %s context does not appear to have valid DNS records." +msgstr "Aviso: el dominio de correo del contexto %s no parece tener registros DNS válidos." + +#. translators: %s: context name +#: replyto.php:557 +#: replyto.php:567 +#, php-format +msgid "Name for %s context was truncated to 255 characters." +msgstr "El nombre del contexto %s se ha truncado a 255 caracteres." + +#: replyto.php:608 +msgid "Reply-To configuration updated successfully." +msgstr "La configuración de Responder a se ha actualizado correctamente." + +#: replyto.php:707 +msgid "Default Reply-To used for all emails that do not match a specific context. This is the fallback when other contexts are not configured." +msgstr "Responder a predeterminado para todos los correos que no coincidan con un contexto específico. Es la opción alternativa cuando otros contextos no están configurados." + +#: replyto.php:708 +msgid "Newsletter confirmations, general notifications, and any emails not covered by other contexts." +msgstr "Confirmaciones de boletines, notificaciones generales y cualquier correo no cubierto por otros contextos." + +#: replyto.php:711 +msgid "Authentication & Security" +msgstr "Autenticación y seguridad" + +#: replyto.php:712 +msgid "Reply-To for password resets, password changes, and email address changes." +msgstr "Responder a para restablecimientos de contraseña, cambios de contraseña y cambios de dirección de correo." + +#: replyto.php:713 +msgid "Password reset requests, password change confirmations, email address verifications." +msgstr "Solicitudes de restablecimiento de contraseña, confirmaciones de cambio de contraseña, verificaciones de dirección de correo." + +#: replyto.php:716 +msgid "Comments & Moderation" +msgstr "Comentarios y moderación" + +#: replyto.php:717 +msgid "Reply-To for comment notifications and moderation alerts." +msgstr "Responder a para notificaciones de comentarios y alertas de moderación." + +#: replyto.php:718 +msgid "New comment notifications, comment moderation alerts, comment replies." +msgstr "Notificaciones de nuevos comentarios, alertas de moderación de comentarios, respuestas a comentarios." + +#: replyto.php:721 +msgid "Users & Registration" +msgstr "Usuarios y registro" + +#: replyto.php:722 +msgid "Reply-To for new user registrations, role changes, and user management emails." +msgstr "Responder a para registros de nuevos usuarios, cambios de rol y correos de gestión de usuarios." + +#: replyto.php:723 +msgid "New user welcome emails, user role changes, account activations." +msgstr "Correos de bienvenida a nuevos usuarios, cambios de rol de usuario, activaciones de cuenta." + +#: replyto.php:726 +msgid "System & Updates" +msgstr "Sistema y actualizaciones" + +#: replyto.php:727 +msgid "Reply-To for automatic updates, system alerts, and critical site health notifications." +msgstr "Responder a para actualizaciones automáticas, alertas del sistema y notificaciones críticas de estado del sitio." + +#: replyto.php:728 +msgid "WordPress core updates, plugin updates, theme updates, recovery mode, fatal error notifications." +msgstr "Actualizaciones del núcleo de WordPress, actualizaciones de plugins, actualizaciones de temas, modo de recuperación, notificaciones de errores fatales." + +#: replyto.php:736 +msgid "Reply-To for WooCommerce order notifications, invoices, and customer communications." +msgstr "Responder a para notificaciones de pedidos de WooCommerce, facturas y comunicaciones con clientes." + +#: replyto.php:737 +msgid "Order confirmations, shipping notifications, invoices, customer notes." +msgstr "Confirmaciones de pedidos, notificaciones de envío, facturas, notas del cliente." + +#: replyto.php:751 +msgid "Configure different Reply-To addresses based on the type of email being sent. Each context can have its own email address and display name." +msgstr "Configure diferentes direcciones de respuesta según el tipo de correo enviado. Cada contexto puede tener su propia dirección de correo electrónico y nombre." + +#: replyto.php:789 +msgid "Active with email configured" +msgstr "Activo con correo configurado" + +#: replyto.php:790 +msgid "Inactive or no email configured" +msgstr "Inactivo o sin correo configurado" + +#: replyto.php:806 +msgid "What this context covers:" +msgstr "Qué cubre este contexto:" + +#: replyto.php:808 +msgid "Examples:" +msgstr "Ejemplos:" + +#: replyto.php:819 +msgid "Enable this context" +msgstr "Activar este contexto" + +#: replyto.php:822 +msgid "When disabled, emails in this context will use the Default Reply-To address." +msgstr "Cuando está desactivado, los correos de este contexto usarán la dirección de Responder a predeterminada." + +#: replyto.php:832 +msgid "Reply-To Email Address" +msgstr "Dirección de correo de respuesta" + +#: replyto.php:842 +msgid "Enter the email address where replies should be sent." +msgstr "Introduzca la dirección de correo a la que se enviarán las respuestas." + +#: replyto.php:849 +msgid "Reply-To Display Name (Optional)" +msgstr "Nombre para mostrar de respuesta (opcional)" + +#: replyto.php:859 +msgid "Optional: Enter a name to display with the email (e.g., \"Support Team\")." +msgstr "Opcional: introduzca un nombre para mostrar junto al correo (p. ej., «Equipo de soporte»)." + +#: replyto.php:868 +msgid "Note:" +msgstr "Nota:" + +#: replyto.php:869 +msgid "The Default context is always active and acts as a fallback for all emails." +msgstr "El contexto predeterminado siempre está activo y actúa como alternativa para todos los correos." + +#: replyto.php:895 +msgid "Save Settings" +msgstr "Guardar ajustes" diff --git a/languages/replyto.pot b/languages/replyto.pot index 023f06a..0fd7fe5 100644 --- a/languages/replyto.pot +++ b/languages/replyto.pot @@ -1,242 +1,212 @@ -#, fuzzy +# Copyright (C) 2026 ROBOTSTXT +# This file is distributed under the GPL-3.0-or-later. msgid "" msgstr "" -"Project-Id-Version: Reply-To for WP_Mail\n" -"POT-Creation-Date: 2026-01-20 18:14+0100\n" -"PO-Revision-Date: 2026-01-20 18:14+0100\n" -"Last-Translator: \n" -"Language-Team: \n" +"Project-Id-Version: Reply-To for WP_Mail 2.0.2\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/replyto\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -"X-Generator: Poedit 3.8\n" -"X-Poedit-Basepath: ..\n" -"X-Poedit-Flags-xgettext: --add-comments=translators:\n" -"X-Poedit-WPHeader: replyto.php\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: " -"__;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" -"X-Poedit-SearchPath-0: .\n" -"X-Poedit-SearchPathExcluded-0: *.min.js\n" -"X-Poedit-SearchPathExcluded-1: vendor\n" +"POT-Creation-Date: 2026-06-05T11:22:01+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.12.0\n" +"X-Domain: replyto\n" -#: replyto.php:326 +#. Plugin Name of the plugin +#: replyto.php +msgid "Reply-To for WP_Mail" +msgstr "" + +#. Description of the plugin +#: replyto.php +msgid "Configure your \"Reply-To:\" for WP_Mail with validation, admin settings, and context-based routing." +msgstr "" + +#. Author of the plugin +#: replyto.php +msgid "ROBOTSTXT" +msgstr "" + +#. Author URI of the plugin +#: replyto.php +msgid "https://www.robotstxt.es/" +msgstr "" + +#: replyto.php:391 msgid "WP Mail Reply-To Settings" msgstr "" -#: replyto.php:327 +#: replyto.php:392 msgid "Reply-To" msgstr "" -#: replyto.php:390 -msgid "The email address format is not valid. Please check and try again." -msgstr "" - -#: replyto.php:405 -msgid "" -"Warning: The email domain does not appear to have valid DNS records. The " -"email may not work correctly." -msgstr "" - -#: replyto.php:436 -msgid "Reply-To email address updated successfully." -msgstr "" - -#: replyto.php:502 replyto.php:675 +#: replyto.php:492 +#: replyto.php:706 msgid "Default" msgstr "" -#: replyto.php:503 +#: replyto.php:493 msgid "Authentication" msgstr "" -#: replyto.php:504 +#: replyto.php:494 msgid "Comments" msgstr "" -#: replyto.php:505 +#: replyto.php:495 msgid "Users" msgstr "" -#: replyto.php:506 +#: replyto.php:496 msgid "System" msgstr "" -#: replyto.php:511 replyto.php:704 +#: replyto.php:501 +#: replyto.php:735 msgid "WooCommerce" msgstr "" #. translators: %s: context name -#: replyto.php:534 +#: replyto.php:526 #, php-format msgid "Invalid email address for %s context." msgstr "" #. translators: %s: context name -#: replyto.php:547 +#: replyto.php:542 +#, php-format +msgid "Warning: The email domain for %s context does not appear to have valid DNS records." +msgstr "" + +#. translators: %s: context name +#: replyto.php:557 +#: replyto.php:567 #, php-format msgid "Name for %s context was truncated to 255 characters." msgstr "" -#: replyto.php:584 +#: replyto.php:608 msgid "Reply-To configuration updated successfully." msgstr "" -#: replyto.php:676 -msgid "" -"Default Reply-To used for all emails that do not match a specific context. " -"This is the fallback when other contexts are not configured." +#: replyto.php:707 +msgid "Default Reply-To used for all emails that do not match a specific context. This is the fallback when other contexts are not configured." msgstr "" -#: replyto.php:677 -msgid "" -"Newsletter confirmations, general notifications, and any emails not covered " -"by other contexts." +#: replyto.php:708 +msgid "Newsletter confirmations, general notifications, and any emails not covered by other contexts." msgstr "" -#: replyto.php:680 +#: replyto.php:711 msgid "Authentication & Security" msgstr "" -#: replyto.php:681 -msgid "" -"Reply-To for password resets, password changes, and email address changes." +#: replyto.php:712 +msgid "Reply-To for password resets, password changes, and email address changes." msgstr "" -#: replyto.php:682 -msgid "" -"Password reset requests, password change confirmations, email address " -"verifications." +#: replyto.php:713 +msgid "Password reset requests, password change confirmations, email address verifications." msgstr "" -#: replyto.php:685 +#: replyto.php:716 msgid "Comments & Moderation" msgstr "" -#: replyto.php:686 +#: replyto.php:717 msgid "Reply-To for comment notifications and moderation alerts." msgstr "" -#: replyto.php:687 +#: replyto.php:718 msgid "New comment notifications, comment moderation alerts, comment replies." msgstr "" -#: replyto.php:690 +#: replyto.php:721 msgid "Users & Registration" msgstr "" -#: replyto.php:691 -msgid "" -"Reply-To for new user registrations, role changes, and user management " -"emails." +#: replyto.php:722 +msgid "Reply-To for new user registrations, role changes, and user management emails." msgstr "" -#: replyto.php:692 +#: replyto.php:723 msgid "New user welcome emails, user role changes, account activations." msgstr "" -#: replyto.php:695 +#: replyto.php:726 msgid "System & Updates" msgstr "" -#: replyto.php:696 -msgid "" -"Reply-To for automatic updates, system alerts, and critical site health " -"notifications." +#: replyto.php:727 +msgid "Reply-To for automatic updates, system alerts, and critical site health notifications." msgstr "" -#: replyto.php:697 -msgid "" -"WordPress core updates, plugin updates, theme updates, recovery mode, fatal " -"error notifications." +#: replyto.php:728 +msgid "WordPress core updates, plugin updates, theme updates, recovery mode, fatal error notifications." msgstr "" -#: replyto.php:705 -msgid "" -"Reply-To for WooCommerce order notifications, invoices, and customer " -"communications." +#: replyto.php:736 +msgid "Reply-To for WooCommerce order notifications, invoices, and customer communications." msgstr "" -#: replyto.php:706 +#: replyto.php:737 msgid "Order confirmations, shipping notifications, invoices, customer notes." msgstr "" -#: replyto.php:720 -msgid "" -"Configure different Reply-To addresses based on the type of email being " -"sent. Each context can have its own email address and display name." -msgstr "" - -#: replyto.php:757 -msgid "Active with email configured" -msgstr "" - -#: replyto.php:758 -msgid "Inactive or no email configured" -msgstr "" - -#: replyto.php:773 -msgid "What this context covers:" -msgstr "" - -#: replyto.php:775 -msgid "Examples:" -msgstr "" - -#: replyto.php:786 -msgid "Enable this context" +#: replyto.php:751 +msgid "Configure different Reply-To addresses based on the type of email being sent. Each context can have its own email address and display name." msgstr "" #: replyto.php:789 -msgid "" -"When disabled, emails in this context will use the Default Reply-To address." +msgid "Active with email configured" msgstr "" -#: replyto.php:799 +#: replyto.php:790 +msgid "Inactive or no email configured" +msgstr "" + +#: replyto.php:806 +msgid "What this context covers:" +msgstr "" + +#: replyto.php:808 +msgid "Examples:" +msgstr "" + +#: replyto.php:819 +msgid "Enable this context" +msgstr "" + +#: replyto.php:822 +msgid "When disabled, emails in this context will use the Default Reply-To address." +msgstr "" + +#: replyto.php:832 msgid "Reply-To Email Address" msgstr "" -#: replyto.php:809 +#: replyto.php:842 msgid "Enter the email address where replies should be sent." msgstr "" -#: replyto.php:816 +#: replyto.php:849 msgid "Reply-To Display Name (Optional)" msgstr "" -#: replyto.php:826 -msgid "" -"Optional: Enter a name to display with the email (e.g., \"Support Team\")." +#: replyto.php:859 +msgid "Optional: Enter a name to display with the email (e.g., \"Support Team\")." msgstr "" -#: replyto.php:835 +#: replyto.php:868 msgid "Note:" msgstr "" -#: replyto.php:836 -msgid "" -"The Default context is always active and acts as a fallback for all emails." +#: replyto.php:869 +msgid "The Default context is always active and acts as a fallback for all emails." msgstr "" -#: replyto.php:861 +#: replyto.php:895 msgid "Save Settings" msgstr "" - -#. Plugin Name of the plugin/theme -msgid "Reply-To for WP_Mail" -msgstr "" - -#. Description of the plugin/theme -msgid "" -"Configure your \"Reply-To:\" for WP_Mail with validation, admin settings, " -"and context-based routing." -msgstr "" - -#. Author of the plugin/theme -msgid "ROBOTSTXT" -msgstr "" - -#. Author URI of the plugin/theme -msgid "https://www.robotstxt.es/" -msgstr "" diff --git a/languages/wp-mail-replyto.pot b/languages/wp-mail-replyto.pot deleted file mode 100644 index e0f7b0a..0000000 --- a/languages/wp-mail-replyto.pot +++ /dev/null @@ -1,68 +0,0 @@ -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Reply-To for WP_Mail\n" -"POT-Creation-Date: 2025-04-08 12:13+0200\n" -"PO-Revision-Date: 2024-10-31 08:58+0100\n" -"Last-Translator: \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -"X-Generator: Poedit 3.6\n" -"X-Poedit-Basepath: ..\n" -"X-Poedit-Flags-xgettext: --add-comments=translators:\n" -"X-Poedit-WPHeader: replyto.php\n" -"X-Poedit-SourceCharset: UTF-8\n" -"X-Poedit-KeywordsList: " -"__;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" -"X-Poedit-SearchPath-0: .\n" -"X-Poedit-SearchPathExcluded-0: *.min.js\n" - -#: replyto.php:97 -msgid "WP Mail Reply-To Settings" -msgstr "" - -#: replyto.php:98 -msgid "Reply-To" -msgstr "" - -#: replyto.php:130 -msgid "Reply-To Configuration" -msgstr "" - -#: replyto.php:138 -msgid "Reply-To Email Address" -msgstr "" - -#: replyto.php:154 -msgid "" -"Set the email address to be used in the \"Reply-To\" header of outgoing " -"emails." -msgstr "" - -#: replyto.php:169 -msgid "Enter the email address to be used as \"Reply-To\"." -msgstr "" - -#: replyto.php:194 -msgid "Save Settings" -msgstr "" - -#. Plugin Name of the plugin/theme -msgid "Reply-To for WP_Mail" -msgstr "" - -#. Description of the plugin/theme -msgid "" -"Configure your \"Reply-To:\" for WP_Mail with validation and admin settings." -msgstr "" - -#. Author of the plugin/theme -msgid "Javier Casares" -msgstr "" - -#. Author URI of the plugin/theme -msgid "https://www.javiercasares.com/" -msgstr "" diff --git a/readme.txt b/readme.txt index 5559fa9..d7419a0 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ === Reply-To for WP_Mail === Contributors: javiercasares Tags: email, reply-to, mail, smtp -Requires at least: 4.1 -Tested up to: 6.9 -Stable tag: 2.0.0 +Requires at least: 3.6 +Tested up to: 7.1 +Stable tag: 2.0.2 Requires PHP: 5.6 -Version: 2.0.0 +Version: 2.0.2 License: GPL-3.0-or-later License URI: https://www.gnu.org/licenses/gpl-3.0.txt @@ -15,70 +15,131 @@ Configure different "Reply-To" addresses by email context with validation, moder 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. + += Does this plugin work on WordPress Multisite? = + +Yes. Each site in a Multisite network maintains its own configuration. On uninstall, data is removed from all sites. + == Compatibility == -* WordPress: 4.1 - 6.9 +* WordPress: 3.6 - 7.1 * PHP: 5.6 - 8.5 == Changelog == -= [2.0.0] - 2026-01-20 = += 2.0.2 = -**Major Release - Context-Based Reply-To Routing** +_Release date: 2026-06-05_ -This major release combines multiple enhancements including context-based email routing, security improvements, and Reply-To name support. +**Highlights** -**Added** - -* Context-based Reply-To routing - Configure different Reply-To addresses for different types of emails. -* Six email contexts: Default, Authentication & Security, Comments & Moderation, Users & Registration, System & Updates, WooCommerce. -* WooCommerce tab only visible when WooCommerce plugin is active. -* Intelligent context detection using backtrace analysis. -* Modern tabbed user interface using WordPress native nav-tab-wrapper. -* Visual status indicators on each tab (green = active with email, red = inactive or no email). -* Legend explaining status indicators for easy understanding. -* Enable/disable toggle for each context (except Default which is always active). -* Fallback chain: Specific context → Default context → Legacy settings. -* Detailed descriptions and examples for each context in the admin UI. -* Reply-To Name field - Now you can specify a name to display with the Reply-To email address (e.g., "Support Team "). -* Name sanitization with header injection prevention. -* Length validation for name field (255 characters maximum). -* Created uninstall.php for proper cleanup of plugin data on uninstallation. -* Implemented logging of configuration changes for security auditing (requires WP_DEBUG_LOG). -* Added DNS validation for email domains with user-friendly warnings. -* Enhanced email validation with additional security checks. -* Added success/error messages for better user feedback. +* Translations added for Spanish (Spain) and Catalan. +* WordPress minimum version corrected to 3.6 based on actual function usage (wp-compat analysis). **Changed** -* Complete rewrite of settings page with modern tab-based interface. -* Email detection now uses backtrace analysis for accurate context identification. -* Settings structure changed from individual options to array-based configuration (wp_mail_replyto_contexts). -* Improved sanitization and validation for multiple contexts. -* Enhanced logging with context information in debug mode. -* Email header construction now supports both name and email format. -* Updated sanitize callback to use custom function with enhanced validation. -* Improved security documentation and code comments. +* Minimum WordPress version updated from 4.1 to 3.6. +* Tested up to WordPress 7.1. +* POT file regenerated via WP-CLI i18n. -**Security Enhancements** +**Added** -* Added explicit header injection prevention with defense-in-depth validation. -* Implemented strict RFC 5322 email format validation. -* Enhanced input sanitization with multiple validation layers. +* Spanish (Spain) translation (es_ES). +* Catalan translation (ca). -**Technical** +**Compatibility** -* New database structure: Single serialized array instead of multiple options (more efficient). -* Backward compatible: Legacy options (v1.0.x) still work during migration period. -* Context detection covers: Password resets, comments, user registration, system updates, WooCommerce emails. -* Clean uninstallation: Removes all options including migration flags. -* Automatic migration from v1.0.x - Your existing settings are preserved in the Default context. +* WordPress: 3.6 - 7.1 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHP Coding Standards: 3.13.5 +* WordPress Coding Standards: 3.3.0 +* PHPStan: 2.2.2 (level 9) +* PHPUnit: 9.6.34 + += 2.0.1 = + +_Release date: 2026-06-05_ + +**Highlights** + +* Major bugfix release addressing three critical issues found during pre-deploy audit. + +**Fixed** + +* Context cache not resetting between emails in the same PHP process. +* Duplicate Reply-To header injected when an existing Reply-To was present. +* Migration hook only running on admin_init — missed WP-CLI activations. +* RFC 5322 display name quoting now applied only when the name contains special characters. + +**Added** + +* Developer filters: wp_mail_replyto_context and wp_mail_replyto_header. +* load_plugin_textdomain() for translation support on WordPress < 4.6. + +**Security** + +* sanitize_callback added to legacy option registrations. + +**Compatibility** + +* WordPress: 4.1 - 6.9 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHP Coding Standards: 3.13.5 +* WordPress Coding Standards: 3.3.0 +* PHPStan: 2.2.2 (level 9) +* PHPUnit: 9.6.34 + += 2.0.0 = + +_Release date: 2026-01-20_ + +**Highlights** + +* Complete rewrite with context-based Reply-To routing. + +**Added** + +* Six email contexts: Default, Authentication, Comments, Users, System, WooCommerce. +* Modern tabbed admin interface with visual status indicators. +* Reply-To display name field with header injection prevention. +* Automatic migration from v1.0.x settings. +* uninstall.php for clean data removal. **Compatibility** @@ -91,38 +152,27 @@ This major release combines multiple enhancements including context-based email * WordPress Coding Standards: 3.3.0 * Plugin Check (PCP): 1.4.0 -= [1.0.3] - 2025-04-08 = += Previous versions = -**Changed** +If you want to see the full changelog, visit the [changelog.txt](https://git.robotstxt.es/ROBOTSTXT/replyto-dev/raw/branch/main/changelog.txt) file. -* Compatible with WordPress 6.8. -* Improved functions documentation. +== Upgrade Notice == -**Compatibility** += 2.0.2 = +Translations added for Spanish (Spain) and Catalan. WordPress minimum corrected to 3.6. Upgrade recommended. -* WordPress: 4.1 - 6.9 -* PHP: 5.6 - 8.5 += 2.0.1 = +Bugfix release. Fixes context isolation between emails, duplicate Reply-To headers, and migration on WP-CLI. Upgrade recommended. -**Tests** += 2.0.0 = +Major release. Your existing Reply-To setting is automatically migrated to the new Default context — no manual action required. -* PHP Coding Standards: 3.12.1 -* WordPress Coding Standards: 3.1.0 -* Plugin Check (PCP): 1.4.0 +== Compliance == -= [1.0.2] - 2024-11-02 = +This plugin adheres to the following security measures and review protocols for each version: -**Fixed** - -* Preparation for GlotPress. - -= [1.0.1] - 2024-10-31 = - -**Added** - -* Translation ready. - -= [1.0.0] - 2024-10-22 = - -**Added** - -* First 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/) diff --git a/replyto.php b/replyto.php index c7cbe35..9701dfb 100644 --- a/replyto.php +++ b/replyto.php @@ -2,9 +2,9 @@ /** * Plugin Name: Reply-To for WP_Mail * Description: Configure your "Reply-To:" for WP_Mail with validation, admin settings, and context-based routing. - * Requires at least: 4.1 + * Requires at least: 3.6 * Requires PHP: 5.6 - * Version: 2.0.0 + * Version: 2.0.2 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.es/ * License: GPL-3.0-or-later @@ -14,18 +14,36 @@ * * @package replyto * - * @version 2.0.0 + * @version 2.0.2 */ defined( 'ABSPATH' ) || die( 'No script kiddies please!' ); +register_activation_hook( __FILE__, 'wp_mail_replyto_migrate_to_v200' ); + +/** + * Loads the plugin text domain. + * + * @since 2.0.0 + * + * @return void + */ +function wp_mail_replyto_load_textdomain() { + load_plugin_textdomain( 'replyto', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); +} + +add_action( 'plugins_loaded', 'wp_mail_replyto_load_textdomain' ); +add_action( 'plugins_loaded', 'wp_mail_replyto_migrate_to_v200' ); + /** * Performs automatic migration from v1.0.x to v2.0.0. * * Migrates old single email/name options to new context-based structure. - * Runs once on plugin activation or when version changes. + * Runs on plugin activation, every request via plugins_loaded (idempotent). * * @since 2.0.0 + * + * @return void */ function wp_mail_replyto_migrate_to_v200() { // Check if migration has already been performed. @@ -35,8 +53,10 @@ function wp_mail_replyto_migrate_to_v200() { } // Get old settings. - $old_email = get_option( 'wp_mail_replyto_email', '' ); - $old_name = get_option( 'wp_mail_replyto_name', '' ); + $old_email_raw = get_option( 'wp_mail_replyto_email', '' ); + $old_name_raw = get_option( 'wp_mail_replyto_name', '' ); + $old_email = is_string( $old_email_raw ) ? $old_email_raw : ''; + $old_name = is_string( $old_name_raw ) ? $old_name_raw : ''; // Check if old settings exist. if ( ! empty( $old_email ) || ! empty( $old_name ) ) { @@ -88,22 +108,28 @@ function wp_mail_replyto_migrate_to_v200() { update_option( 'wp_mail_replyto_migration_v200', true ); } -add_action( 'admin_init', 'wp_mail_replyto_migrate_to_v200' ); - /** * Detects email context based on WordPress backtrace. * - * Analyzes the call stack to determine what type of email is being sent - * and returns the appropriate context identifier. + * Analyzes the call stack to determine what type of email is being sent. + * Uses DEBUG_BACKTRACE_IGNORE_ARGS with a 20-frame limit for production safety. + * The detected value is cached in a static variable; pass $reset = true to clear + * the cache between emails (called automatically by wp_mail_replyto_reset_context). * * @since 1.3.0 * + * @param bool $reset If true, clears the static cache and returns without detecting. * @return string Context: 'authentication', 'comments', 'users', 'system', 'woocommerce', or 'default'. */ -function wp_mail_replyto_detect_context() { +function wp_mail_replyto_detect_context( $reset = false ) { static $context = null; - // Use cached value if available (for performance). + if ( $reset ) { + $context = null; + return ''; + } + + // Use cached value if available (for performance within the same email). if ( null !== $context ) { return $context; } @@ -112,6 +138,8 @@ function wp_mail_replyto_detect_context() { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace -- Not debug code: debug_backtrace() is essential for production context detection. It analyzes the call stack to identify which WordPress function is sending the email (e.g., retrieve_password, wp_notify_postauthor). This is the core functionality of the plugin, not debugging. The function is optimized with DEBUG_BACKTRACE_IGNORE_ARGS and limited to 20 frames for performance. $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 20 ); + $detected = 'default'; + foreach ( $backtrace as $trace ) { if ( empty( $trace['function'] ) ) { continue; @@ -130,8 +158,8 @@ function wp_mail_replyto_detect_context() { ), true ) ) { - $context = 'authentication'; - return $context; + $detected = 'authentication'; + break; } // Comments context. @@ -145,8 +173,8 @@ function wp_mail_replyto_detect_context() { ), true ) ) { - $context = 'comments'; - return $context; + $detected = 'comments'; + break; } // Users context. @@ -159,8 +187,8 @@ function wp_mail_replyto_detect_context() { ), true ) ) { - $context = 'users'; - return $context; + $detected = 'users'; + break; } // System context. @@ -174,35 +202,46 @@ function wp_mail_replyto_detect_context() { ), true ) ) { - $context = 'system'; - return $context; + $detected = 'system'; + break; } // WooCommerce context. if ( ! empty( $class ) && false !== strpos( $class, 'WC_Email' ) ) { - $context = 'woocommerce'; - return $context; + $detected = 'woocommerce'; + break; } } - // Default context if no specific match. - $context = 'default'; + /** + * Filters the detected email context. + * + * Allows overriding the context before the Reply-To address is resolved. + * Return a custom context key to apply a different Reply-To configuration, + * or 'default' to use the fallback. + * + * @since 2.0.0 + * + * @param string $detected Detected context: 'authentication', 'comments', 'users', + * 'system', 'woocommerce', or 'default'. + */ + $context = (string) apply_filters( 'wp_mail_replyto_context', $detected ); return $context; } /** * Resets the context cache after email is sent. * - * Ensures each email detection starts fresh. + * Ensures each email detection starts fresh when multiple emails are sent + * within the same PHP process (e.g., WP-Cron, REST batch). * * @since 1.3.0 * - * @param array $args Email arguments. - * @return array Unmodified email arguments. + * @param array{to: string|string[], subject: string, message: string, headers: string|string[], attachments: string[]} $args Email arguments. + * @return array{to: string|string[], subject: string, message: string, headers: string|string[], attachments: string[]} Unmodified email arguments. */ function wp_mail_replyto_reset_context( $args ) { - // Reset static cache in detect function. - wp_mail_replyto_detect_context(); + wp_mail_replyto_detect_context( true ); return $args; } @@ -213,37 +252,55 @@ add_filter( 'wp_mail', 'wp_mail_replyto_reset_context', 999 ); * * Detects email context and applies appropriate Reply-To based on configuration. * Falls back to default context if specific context is not configured. + * Removes any existing Reply-To header before injecting the configured value. * * @since 1.3.0 Updated to support context-based Reply-To. * - * @param array $args The email arguments passed to wp_mail(). - * @return array Modified email arguments with adjusted "Reply-To" header. + * @param array{to: string|string[], subject: string, message: string, headers: string|string[], attachments: string[]} $args The email arguments passed to wp_mail(). + * @return array{to: string|string[], subject: string, message: string, headers: string|string[], attachments: string[]} Modified email arguments with adjusted "Reply-To" header. */ function wp_mail_replyto( $args ) { // Detect email context. $detected_context = wp_mail_replyto_detect_context(); // Get all contexts configuration. - $contexts = get_option( 'wp_mail_replyto_contexts', array() ); + $contexts_raw = get_option( 'wp_mail_replyto_contexts', array() ); + $contexts = is_array( $contexts_raw ) ? $contexts_raw : array(); + + // Normalize the detected context entry. + $detected_ctx = isset( $contexts[ $detected_context ] ) && is_array( $contexts[ $detected_context ] ) + ? $contexts[ $detected_context ] + : array(); + + // Normalize the default context entry. + $default_ctx = isset( $contexts['default'] ) && is_array( $contexts['default'] ) + ? $contexts['default'] + : array(); // Fallback chain: specific context -> default -> legacy. $reply_to_email = ''; $reply_to_name = ''; - // Try specific context first (if enabled). - if ( isset( $contexts[ $detected_context ] ) && - ! empty( $contexts[ $detected_context ]['enabled'] ) && - ! empty( $contexts[ $detected_context ]['email'] ) ) { - $reply_to_email = $contexts[ $detected_context ]['email']; - $reply_to_name = $contexts[ $detected_context ]['name']; - } elseif ( isset( $contexts['default'] ) && ! empty( $contexts['default']['email'] ) ) { - // Fall back to default context. - $reply_to_email = $contexts['default']['email']; - $reply_to_name = $contexts['default']['name']; + $detected_email = isset( $detected_ctx['email'] ) && is_string( $detected_ctx['email'] ) ? $detected_ctx['email'] : ''; + $detected_enabled = ! empty( $detected_ctx['enabled'] ); + + if ( $detected_enabled && ! empty( $detected_email ) ) { + // Specific context is configured and enabled. + $reply_to_email = $detected_email; + $reply_to_name = isset( $detected_ctx['name'] ) && is_string( $detected_ctx['name'] ) ? $detected_ctx['name'] : ''; } else { - // Final fallback: legacy single option (for migration period). - $reply_to_email = get_option( 'wp_mail_replyto_email', '' ); - $reply_to_name = get_option( 'wp_mail_replyto_name', '' ); + $default_email = isset( $default_ctx['email'] ) && is_string( $default_ctx['email'] ) ? $default_ctx['email'] : ''; + if ( ! empty( $default_email ) ) { + // Fall back to default context. + $reply_to_email = $default_email; + $reply_to_name = isset( $default_ctx['name'] ) && is_string( $default_ctx['name'] ) ? $default_ctx['name'] : ''; + } else { + // Final fallback: legacy single option (for migration period). + $legacy_email = get_option( 'wp_mail_replyto_email', '' ); + $legacy_name = get_option( 'wp_mail_replyto_name', '' ); + $reply_to_email = is_string( $legacy_email ) ? $legacy_email : ''; + $reply_to_name = is_string( $legacy_name ) ? $legacy_name : ''; + } } // Explicit header injection prevention - defense in depth. @@ -256,55 +313,61 @@ function wp_mail_replyto( $args ) { } // Construct the new "Reply-To" header if a valid email address is set. + $new_reply_to = ''; if ( ! empty( $reply_to_email ) && is_email( $reply_to_email ) ) { + $safe_email = sanitize_email( $reply_to_email ); if ( ! empty( $reply_to_name ) ) { - // Include name in Reply-To header. - $new_reply_to = 'Reply-To: ' . sanitize_text_field( $reply_to_name ) . ' <' . sanitize_email( $reply_to_email ) . '>'; + $display_name = sanitize_text_field( $reply_to_name ); + // Strip any surrounding double-quotes the user may have typed manually. + $display_name = trim( $display_name, '"' ); + // RFC 5322 specials that require a quoted-string: ( ) < > [ ] : ; @ backslash comma period and double-quote. + if ( preg_match( '/[()<>\[\]:;@\\\\,."\\r\\n]/', $display_name ) ) { + $safe_name = str_replace( array( '\\', '"' ), array( '\\\\', '\\"' ), $display_name ); + $new_reply_to = 'Reply-To: "' . $safe_name . '" <' . $safe_email . '>'; + } else { + // Simple phrase: no quoting needed. + $new_reply_to = 'Reply-To: ' . $display_name . ' <' . $safe_email . '>'; + } } else { // Email only. - $new_reply_to = 'Reply-To: <' . sanitize_email( $reply_to_email ) . '>'; + $new_reply_to = 'Reply-To: <' . $safe_email . '>'; } } - // Initialize variables to track the "From" and existing "Reply-To" headers. - $from = ''; - $existing_reply_to = ''; + /** + * Filters the Reply-To header string before injection. + * + * Return an empty string to suppress Reply-To injection for this email. + * + * @since 2.0.0 + * + * @param string $new_reply_to The constructed Reply-To header (e.g. 'Reply-To: '). + * @param array{to: string|string[], subject: string, message: string, headers: string|string[], attachments: string[]} $args The wp_mail arguments. + */ + $new_reply_to = (string) apply_filters( 'wp_mail_replyto_header', $new_reply_to, $args ); // Check if email headers exist. if ( ! empty( $args['headers'] ) ) { // Normalize headers into an array if they are not already. if ( ! is_array( $args['headers'] ) ) { - $args['headers'] = array_filter( explode( "\n", str_replace( "\r\n", "\n", $args['headers'] ) ) ); - } - - // Loop through the headers to locate "From" and "Reply-To" values. - foreach ( $args['headers'] as $header ) { - if ( stripos( $header, 'from:' ) === 0 ) { - $from = trim( substr( $header, strlen( 'from:' ) ) ); - } - if ( stripos( $header, 'reply-to:' ) === 0 ) { - $existing_reply_to = trim( substr( $header, strlen( 'reply-to:' ) ) ); - } - } - - // If "Reply-To" exists and matches the "From" address, replace it with the new one. - if ( ! empty( $existing_reply_to ) && strtolower( $existing_reply_to ) === strtolower( $from ) ) { - // Remove the existing "Reply-To" header. $args['headers'] = array_filter( - $args['headers'], - function ( $header ) { - return stripos( $header, 'reply-to:' ) !== 0; - } + explode( "\n", str_replace( array( "\r\n", "\r" ), "\n", $args['headers'] ) ) ); + } - // Add the new "Reply-To" header. - $args['headers'][] = $new_reply_to; - - } elseif ( isset( $new_reply_to ) ) { - // If no conflicting "Reply-To" is found, append the new one. + if ( ! empty( $new_reply_to ) ) { + // Remove any existing Reply-To header unconditionally (RFC 5322 allows only one). + $args['headers'] = array_values( + array_filter( + $args['headers'], + function ( $header ) { + return stripos( $header, 'reply-to:' ) !== 0; + } + ) + ); $args['headers'][] = $new_reply_to; } - } elseif ( isset( $new_reply_to ) ) { + } elseif ( ! empty( $new_reply_to ) ) { // If no headers exist at all, create a new headers array with the "Reply-To". $args['headers'] = array( $new_reply_to ); } @@ -320,6 +383,8 @@ add_filter( 'wp_mail', 'wp_mail_replyto' ); * * Adds a new page under the "Settings" menu where administrators can configure * the "Reply-To" email address used in outgoing emails. + * + * @return void */ function wp_mail_replyto_add_settings_page() { add_options_page( @@ -363,91 +428,14 @@ function wp_mail_replyto_validate_email_strict( $email ) { return true; } -/** - * Sanitizes and logs changes to the Reply-To email setting. - * - * This function sanitizes the input email address and logs any changes - * for security auditing purposes. It's used as the sanitize_callback - * for the plugin settings. - * - * @since 1.1.0 - * - * @param string $input The input email address to sanitize. - * @return string The sanitized email address. - */ -function wp_mail_replyto_sanitize_and_log( $input ) { - // Sanitize the email address. - $sanitized = sanitize_email( $input ); - - // Get the old value for comparison. - $old_value = get_option( 'wp_mail_replyto_email', '' ); - - // Perform strict validation. - if ( ! empty( $sanitized ) && ! wp_mail_replyto_validate_email_strict( $sanitized ) ) { - add_settings_error( - 'wp_mail_replyto_messages', - 'wp_mail_replyto_invalid_email', - esc_html__( 'The email address format is not valid. Please check and try again.', 'replyto' ), - 'error' - ); - // Return the old value if validation fails. - return $old_value; - } - - // Check domain existence (optional validation with warning only). - if ( ! empty( $sanitized ) ) { - $domain = substr( strrchr( $sanitized, '@' ), 1 ); - if ( ! empty( $domain ) && function_exists( 'checkdnsrr' ) ) { - if ( ! checkdnsrr( $domain, 'MX' ) && ! checkdnsrr( $domain, 'A' ) ) { - add_settings_error( - 'wp_mail_replyto_messages', - 'wp_mail_replyto_domain_warning', - esc_html__( 'Warning: The email domain does not appear to have valid DNS records. The email may not work correctly.', 'replyto' ), - 'warning' - ); - } - } - } - - // Log changes for security auditing. - if ( $old_value !== $sanitized ) { - $user = wp_get_current_user(); - - // Use error_log for logging (can be configured in wp-config.php). - if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Intentional: error_log() is used for security audit logging, not debugging. Only active when WP_DEBUG_LOG is enabled. Records configuration changes with user info and IP for security compliance and troubleshooting. This is a production feature for administrators who enable logging in wp-config.php. - error_log( - sprintf( - '[Reply-To Plugin] Email changed from "%s" to "%s" by user %s (ID: %d) from IP: %s', - $old_value, - $sanitized, - $user->user_login, - $user->ID, - isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : 'unknown' - ) - ); - } - - // Add success message if change was successful. - if ( ! empty( $sanitized ) || ! empty( $old_value ) ) { - add_settings_error( - 'wp_mail_replyto_messages', - 'wp_mail_replyto_updated', - esc_html__( 'Reply-To email address updated successfully.', 'replyto' ), - 'success' - ); - } - } - - return $sanitized; -} - /** * Registers the plugin settings, section, and field in the WordPress Settings API. * * This function defines the context-based configuration structure. * * @since 1.3.0 Updated to support multiple contexts. + * + * @return void */ function wp_mail_replyto_register_settings() { // Register the contexts setting. @@ -461,13 +449,14 @@ function wp_mail_replyto_register_settings() { ) ); - // Keep legacy settings registered for backward compatibility during migration. + // Legacy settings kept for backward compatibility during migration. register_setting( 'wp_mail_replyto_settings_group', 'wp_mail_replyto_email', array( - 'type' => 'string', - 'default' => '', + 'type' => 'string', + 'sanitize_callback' => 'sanitize_email', + 'default' => '', ) ); @@ -475,8 +464,9 @@ function wp_mail_replyto_register_settings() { 'wp_mail_replyto_settings_group', 'wp_mail_replyto_name', array( - 'type' => 'string', - 'default' => '', + 'type' => 'string', + 'sanitize_callback' => 'sanitize_text_field', + 'default' => '', ) ); } @@ -486,13 +476,13 @@ add_action( 'admin_init', 'wp_mail_replyto_register_settings' ); /** * Sanitizes and validates the contexts configuration. * - * Validates all context email addresses and names, provides appropriate - * error messages, and logs changes. + * Validates all context email addresses and names, performs DNS validation, + * provides appropriate error messages, and logs changes. * * @since 1.3.0 * - * @param array $input The input contexts array. - * @return array The sanitized contexts array. + * @param array $input The input contexts array. + * @return array The sanitized contexts array. */ function wp_mail_replyto_sanitize_contexts( $input ) { $sanitized = array(); @@ -513,9 +503,11 @@ function wp_mail_replyto_sanitize_contexts( $input ) { foreach ( $available_contexts as $context_key => $context_label ) { // Get input for this context. - $email = isset( $input[ $context_key ]['email'] ) ? sanitize_email( $input[ $context_key ]['email'] ) : ''; - $name = isset( $input[ $context_key ]['name'] ) ? sanitize_text_field( $input[ $context_key ]['name'] ) : ''; - $enabled = isset( $input[ $context_key ]['enabled'] ) && '1' === $input[ $context_key ]['enabled']; + $ctx_input = isset( $input[ $context_key ] ) && is_array( $input[ $context_key ] ) ? $input[ $context_key ] : array(); + $email = isset( $ctx_input['email'] ) && is_string( $ctx_input['email'] ) ? sanitize_email( $ctx_input['email'] ) : ''; + $name = isset( $ctx_input['name'] ) && is_string( $ctx_input['name'] ) ? sanitize_text_field( $ctx_input['name'] ) : ''; + $enabled_raw = isset( $ctx_input['enabled'] ) ? $ctx_input['enabled'] : ''; + $enabled = '1' === $enabled_raw || true === $enabled_raw; // Header injection prevention. if ( ! empty( $email ) ) { @@ -537,8 +529,36 @@ function wp_mail_replyto_sanitize_contexts( $input ) { $email = ''; } - // Limit name length. - if ( strlen( $name ) > 255 ) { + // Check domain existence (optional validation with warning only). + if ( ! empty( $email ) && function_exists( 'checkdnsrr' ) ) { + $domain_str = strrchr( $email, '@' ); + if ( false !== $domain_str ) { + $domain = substr( $domain_str, 1 ); + if ( ! empty( $domain ) && ! checkdnsrr( $domain, 'MX' ) && ! checkdnsrr( $domain, 'A' ) ) { + add_settings_error( + 'wp_mail_replyto_messages', + 'wp_mail_replyto_domain_warning_' . $context_key, + /* translators: %s: context name */ + sprintf( esc_html__( 'Warning: The email domain for %s context does not appear to have valid DNS records.', 'replyto' ), $context_label ), + 'warning' + ); + } + } + } + + // Limit name length (multibyte-aware). + if ( function_exists( 'mb_strlen' ) ) { + if ( mb_strlen( $name, 'UTF-8' ) > 255 ) { + $name = mb_substr( $name, 0, 255, 'UTF-8' ); + add_settings_error( + 'wp_mail_replyto_messages', + 'wp_mail_replyto_name_long_' . $context_key, + /* translators: %s: context name */ + sprintf( esc_html__( 'Name for %s context was truncated to 255 characters.', 'replyto' ), $context_label ), + 'warning' + ); + } + } elseif ( strlen( $name ) > 255 ) { $name = substr( $name, 0, 255 ); add_settings_error( 'wp_mail_replyto_messages', @@ -565,7 +585,11 @@ function wp_mail_replyto_sanitize_contexts( $input ) { // Log changes if in debug mode. $old_value = get_option( 'wp_mail_replyto_contexts', array() ); if ( $old_value !== $sanitized ) { - $user = wp_get_current_user(); + $user = wp_get_current_user(); + $remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) && is_string( $_SERVER['REMOTE_ADDR'] ) + ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) + : 'unknown'; + if ( defined( 'WP_DEBUG' ) && WP_DEBUG && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Intentional: error_log() is used for security audit logging, not debugging. Only active when WP_DEBUG_LOG is enabled. Records context configuration changes with user info and IP for security compliance and troubleshooting. This is a production feature for administrators who enable logging in wp-config.php. error_log( @@ -573,7 +597,7 @@ function wp_mail_replyto_sanitize_contexts( $input ) { '[Reply-To Plugin] Contexts configuration updated by user %s (ID: %d) from IP: %s', $user->user_login, $user->ID, - isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : 'unknown' + $remote_addr ) ); } @@ -595,14 +619,18 @@ function wp_mail_replyto_sanitize_contexts( $input ) { * @since 1.3.0 * * @param string $hook The current admin page hook. + * @return void */ function wp_mail_replyto_admin_styles( $hook ) { if ( 'settings_page_replyto' !== $hook ) { return; } - ?> - -
@@ -844,9 +877,10 @@ function wp_mail_replyto_render_settings_page() { continue; } - $ctx_email = isset( $contexts[ $key ]['email'] ) ? $contexts[ $key ]['email'] : ''; - $ctx_name = isset( $contexts[ $key ]['name'] ) ? $contexts[ $key ]['name'] : ''; - $ctx_enabled = isset( $contexts[ $key ]['enabled'] ) ? $contexts[ $key ]['enabled'] : false; + $ctx_data = isset( $contexts[ $key ] ) && is_array( $contexts[ $key ] ) ? $contexts[ $key ] : array(); + $ctx_email = isset( $ctx_data['email'] ) && is_string( $ctx_data['email'] ) ? $ctx_data['email'] : ''; + $ctx_name = isset( $ctx_data['name'] ) && is_string( $ctx_data['name'] ) ? $ctx_data['name'] : ''; + $ctx_enabled = ! empty( $ctx_data['enabled'] ); ?>