This commit is contained in:
Javier Casares 2026-08-17 19:16:01 +00:00
commit 1f308e8917
15 changed files with 2136 additions and 2087 deletions

5
.gitignore vendored
View file

@ -1,5 +0,0 @@
/vendor/
/composer.lock
/.codegraph/
/.claude/
*.zip

View file

@ -1,144 +0,0 @@
# Changelog
All notable changes to SMTP (by ROBOTSTXT) are documented in this file.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [2.2.3] - 2026-06-09
### Fixed
* **DKIM "Try selector" form broken in Network Admin.** The hidden `page` input was constructed as `self::NETWORK_MENU_SLUG . '-tools'` (`robotstxt-smtp-network-tools`), which does not exist. Both the site and the network menus register the Tools page under the same `self::TOOLS_PAGE_SLUG` constant (`robotstxt-smtp-tools`). Fixed to always use `self::TOOLS_PAGE_SLUG`.
---
## [2.2.2] - 2026-06-09
### Fixed
* **From Email / Reply-To Email not clearing.** `sanitize_options()` treated an empty submitted value as "keep the current value". Added explicit `$clean['from_email'] = ''` / `$clean['reply_to_email'] = ''` in the `else` branch so blanking the field is persisted.
* **"Clear password" had no effect.** `update_option()` always runs the registered `sanitize_option_{name}` callback, which re-applies the old password when the submitted value is empty. Fixed by temporarily removing the filter before `update_option()` and re-adding it after.
* **"Clear password" submitted to `options.php`.** The button was rendered inside a `<form>` nested inside the settings form. Nested forms are invalid HTML; the browser submits the outer form instead. Replaced with a `wp_nonce_url()` GET link that submits independently.
* **DKIM "Try selector" button did nothing.** The `<form>` was inside the cached tool HTML rendered via `wp_kses_post()`, which strips `<form>`, `<input>`, and `<button>` tags. Moved the form to `render_tools_page()` as direct PHP output, never passing through kses.
* **Spamhaus ZEN false "Listed" result.** Response code `127.255.255.254` is a Spamhaus infrastructure error ("query via public/open DNS resolver"), not a blacklist hit. Spamhaus dropped support for public-resolver queries in 2022. The plugin now detects `127.255.255.254` (open resolver) and `127.255.255.255` (rate limit exceeded) before setting `listed = true`, and shows an informational error with a link to the provider's web lookup tool.
### Added
* **DKIM selector auto-detection from MX records.** The authentication tool now checks the domain's MX records against known provider patterns and tries their well-known selectors before falling back to `default`. Providers covered: Google Workspace (`google`, `google2`), Microsoft 365 (`selector1`, `selector2`), Zoho (`zoho`, `zmail`), ProtonMail (`protonmail`, `protonmail2`, `protonmail3`), Apple iCloud (`sig1`), Aruba (`a1`), Mailchimp (`k1`, `k2`, `k3`).
* **"Try a specific selector" form** in Tools → Authentication. A GET form rendered outside `wp_kses_post()` allows overriding the auto-detected selector. The chosen selector is preserved in the "Run checks again" URL.
* **Password field placeholder is now context-aware.** Shows `No password set.` when no password is stored, and `Leave empty to keep the current password.` when one exists — no ambiguity for screen readers or keyboard-only users.
---
## [2.2.1] - 2026-06-09
### Fixed
* Statistics chart no longer renders a blank canvas. `chart.umd.min.js` was enqueued in the footer with `$in_footer = true`, but the initialization `<script>` block in the page body ran before the library loaded. The inline script is now registered via `wp_add_inline_script('robotstxt-smtp-chartjs', ..., 'after')`, which WordPress places immediately after `chart.umd.min.js` in output order.
* Removed the CDN reference for Chart.js entirely. The library (`chart.umd.min.js` 4.4.0, 200 KB) is now bundled locally in `assets/js/` and enqueued via `wp_enqueue_script()`. No external HTTP requests are made by the plugin.
---
## [2.2.0] - 2026-06-09
### Security
* Fixed passwords with special characters (`<`, `>`, newlines) being silently corrupted by `sanitize_text_field()` on save — both in per-site and network settings handlers. Passwords now use `wp_unslash()` only before encryption.
* Fixed decrypted credentials (password, Amazon SES access key and secret key) being stored in a 10-minute transient after a test email. Credentials are now removed from the settings map before it is persisted.
* Fixed credential mask in the test email panel: `str_repeat('•', 8)` produced the literal string `••...` instead of bullet characters. Now uses `"\u{2022}"` (double-quoted). All three credential fields are now masked.
* Rate-limit enforcement now returns `false` from `pre_wp_mail` to short-circuit `wp_mail()` immediately (WP 5.7+ API), avoiding unnecessary PHPMailer instantiation on every rate-limited send attempt.
### Fixed
* DMARC diagnostics tool now implements RFC 7489 §6.6.3 organizational domain fallback: if no `_dmarc.sub.example.com` record exists, the tool retries against `_dmarc.example.com` and informs the administrator which level applies.
* DKIM and DMARC DNS lookups now go through `safe_dns_lookup()` (2-second timeout), preventing long admin page load times when the DNS server is unreachable.
* Rate-limit transients (`robotstxt_smtp_rate_limit_*`) are now cleaned up on plugin uninstall in both site and network scopes.
### Compatibility
* **WordPress:** minimum lowered from 6.5 to **5.9** (confirmed by static analysis via `johnbillion/wp-compat` — the earliest hook used is `wp_mail_succeeded`, introduced in WP 5.9.0).
* **PHP:** minimum lowered from 8.2 to **8.0** (confirmed by `phpcompatibility/php-compatibility` 10.0.0-alpha2 scan — the earliest PHP 8.x feature used is `str_starts_with()`, introduced in PHP 8.0).
* Tested with WordPress **7.1** (development branch).
### Developer
* Added `composer.json` with full `require-dev` toolchain: PHPCS, WPCS, PHPCompatibility 10.0.0-alpha2, PHPStan 2.x, phpstan-wordpress, PHPUnit 9.x, wp-compat.
* PHPCS (`WordPress-Core`, `WordPress-Docs`, `WordPress-Extra`): **0 errors**.
* PHPStan level 9: **0 errors** across all files.
* PHPCompatibility 10.0.0-alpha2 (PHP 8.0–8.5): **0 errors**.
* WP-compat (WP 5.9+): **0 issues**.
* Added `bin/deploy.sh` for reproducible ZIP artifact generation.
* Added `docs/audit-pre-deploy-2.2.0.md` with full security audit report.
* Renamed `robotstxt-updater.php` → `class-robotstxt-updater.php` (WordPress file naming convention).
* Chart.js CDN script moved from inline `<script src>` to `wp_enqueue_script()` (enqueued only on the Statistics page).
* Added `phpcs.xml` and `phpstan.neon` configuration files.
---
## [2.1.0] - 2026-02-09
### Added
* Data management option to control whether plugin data is deleted on uninstall (disabled by default).
* Reset plugin data functionality with site-level and network-level support.
* Unified uninstall cleanup system that handles all add-on data (Amazon SES, Newsletter).
* Automatic password clearing when both host and username fields are empty.
### Changed
* Uninstall behavior now respects user preference: data is preserved by default unless explicitly enabled.
* Add-on plugins (Amazon SES, Newsletter) no longer perform cleanup on uninstall — centralized in the core plugin.
---
## [2.0.1] - 2026-01-30
### Fixed
* Automatic password clearing when both host and username fields are empty to prevent orphaned credentials.
---
## [2.0.0] - 2026-01-29
### Security
* Comprehensive security audit and hardening.
* Enhanced nonce validation across all forms and actions.
* Improved input sanitization and validation.
* Enhanced password encryption and migration system.
* Secure handling of superglobals and transients.
* Strengthened regex patterns and port number validation.
### Added
* Reply-To email and name configuration fields for custom reply addresses.
* Email statistics tracking system with daily counters and visual charts.
* Statistics page with Chart.js visualization and multisite support.
* Statistics retention settings (configurable from 1 to 365 days).
### Fixed
* Access control and form handling improvements.
* WordPress Multisite rate limiting enhancements.
* Empty password field handling.
---
## [1.1.0]
### Added
* Amazon SES credential fields, regional selection, and live validation helpers.
* `robotstxt_smtp_sanitized_options` filter for add-ons to adjust sanitized settings.
* Routing of SMTP test messages and regular emails through Amazon SES when the add-on is active.
---
## [1.0.0]
### Added
* Contextual help guidance in every SMTP configuration field.
* Automatic port updates when selecting an encryption method with standard values.
* Advanced tools: MX analysis, SPF/DKIM/DMARC validation, extended SMTP diagnostics, and blacklist monitoring.
* Enhanced logging with automatic cleanup by limit or age.

View file

@ -1,5 +1,33 @@
== Changelog ==
= 2.2.4 =
_Release date: 2026-08-17_
**Added**
* Dismissible admin notice on the site and network Plugins pages when the Manager (by ROBOTSTXT) plugin is not installed and active. The Manager plugin delivers updates for this plugin and can be downloaded from https://www.robotstxt.software/plugins/robotstxt-manager/.
* Non-dismissible warning on the plugin settings pages (site and network) when the Manager plugin is not active.
**Changed**
* Plugin updates are now delivered through the Manager (by ROBOTSTXT) plugin. The built-in Gitea updater (`class-robotstxt-updater.php`) and its `update.json` file were removed.
* Plugin URI and Update URI now point to https://www.robotstxt.software/plugins/robotstxt-smtp/ and the developer is ROBOTSTXT (https://www.robotstxt.software/).
* Contributor order updated: robotstxt, javiercasares.
**Compatibility**
* WordPress: 5.9 - 7.1
* PHP: 8.0 - 8.5
**Tests**
* PHP Coding Standards: squizlabs/php_codesniffer 3.13.6, wp-coding-standards/wpcs 3.4.1
* WordPress Coding Standards: WordPress-Core, WordPress-Docs, WordPress-Extra
* PHPStan: level 9, phpstan 2.2.8, szepeviktor/phpstan-wordpress 2.x
* PHPCompatibility: phpcompatibility/php-compatibility 10.0.0-alpha2 (PHP 5.6-8.5 scanned; real floor 8.0)
* WP Compatibility: johnbillion/wp-compat (WP 4.0+ scanned; real floor 5.9)
= 2.2.3 =
_Release date: 2026-06-09_

View file

@ -1,404 +0,0 @@
<?php
/**
* Generic JSON-based updater for ROBOTSTXT plugins.
*
* This file is designed to be copied to any ROBOTSTXT plugin.
* It auto-configures itself by reading the plugin headers.
*
* @package ROBOTSTXT
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Robotstxt_Updater' ) ) {
/**
* Class Robotstxt_Updater
*
* Generic updater that works with any plugin.
* Reads plugin headers and constructs update URL automatically.
*/
class Robotstxt_Updater {
/**
* Plugin file path.
*
* @var string
*/
private string $plugin_file_path;
/**
* Plugin basename (e.g., 'my-plugin/my-plugin.php').
*
* @var string
*/
private string $plugin_basename;
/**
* Plugin slug (directory name).
*
* @var string
*/
private string $plugin_slug;
/**
* Remote JSON URL.
*
* @var string
*/
private string $json_url;
/**
* Cache key.
*
* @var string
*/
private string $cache_key;
/**
* Plugin headers.
*
* @var array<string, bool|string>
*/
private array $plugin_data;
/**
* Initialize the updater.
*
* Usage in your main plugin file:
* require_once __DIR__ . '/robotstxt-updater.php';
* Robotstxt_Updater::init( __FILE__ );
*
* @param string $plugin_file_path Absolute path to the main plugin file.
*/
public static function init( string $plugin_file_path ): void {
$instance = new self( $plugin_file_path );
$instance->register();
}
/**
* Constructor.
*
* @param string $plugin_file_path Absolute path to the main plugin file.
*/
private function __construct( string $plugin_file_path ) {
$this->plugin_file_path = $plugin_file_path;
$this->plugin_basename = plugin_basename( $plugin_file_path );
$this->plugin_slug = dirname( $this->plugin_basename );
$this->plugin_data = $this->get_plugin_data();
$this->json_url = $this->build_json_url();
$this->cache_key = 'robotstxt_updater_' . md5( $this->plugin_basename );
}
/**
* Register WordPress hooks.
*/
private function register(): void {
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'inject_update_info' ) );
add_filter( 'plugins_api', array( $this, 'provide_plugin_details' ), 10, 3 );
add_action( 'admin_init', array( $this, 'handle_cache_clear' ) );
add_action( 'robotstxt_updater_clear_cache', array( $this, 'clear_cache' ) );
}
/**
* Get plugin headers.
*
* @return array<string, bool|string> Plugin data.
*/
private function get_plugin_data(): array {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return get_plugin_data( $this->plugin_file_path, false, false );
}
/**
* Build JSON URL from plugin headers.
*
* Tries to use "Gitea Plugin URI" header to construct the URL.
* Falls back to Plugin URI if Gitea URI is not available.
*
* @return string JSON URL.
*/
private function build_json_url(): string {
// Try Gitea Plugin URI (format: "OWNER/REPO" or full URL).
$gitea_uri_raw = $this->plugin_data['Gitea Plugin URI'] ?? '';
if ( ! empty( $gitea_uri_raw ) && is_string( $gitea_uri_raw ) ) {
$gitea_uri = $gitea_uri_raw;
// If it's already a full URL, use it.
if ( str_starts_with( $gitea_uri, 'http' ) ) {
// Extract base URL and construct JSON path.
return rtrim( $gitea_uri, '/' ) . '/raw/branch/main/update.json';
}
// If it's in format "OWNER/REPO", construct full URL.
if ( preg_match( '#^[^/]+/[^/]+$#', $gitea_uri ) ) {
return "https://git.robotstxt.es/{$gitea_uri}/raw/branch/main/update.json";
}
}
// Fallback: try to extract from Plugin URI.
$plugin_uri_raw = $this->plugin_data['PluginURI'] ?? '';
if ( ! empty( $plugin_uri_raw ) && is_string( $plugin_uri_raw ) ) {
$plugin_uri = $plugin_uri_raw;
if ( str_contains( $plugin_uri, 'git.robotstxt.es' ) ) {
return rtrim( $plugin_uri, '/' ) . '/raw/branch/main/update.json';
}
}
// Last resort: construct from plugin slug.
return "https://git.robotstxt.es/ROBOTSTXT/{$this->plugin_slug}/raw/branch/main/update.json";
}
/**
* Inject update info into WP's plugin update transient.
*
* @param object|mixed $transient The update_plugins transient.
*
* @return object The modified transient.
*/
public function inject_update_info( $transient ) {
if ( ! is_object( $transient ) ) {
$transient = new stdClass();
}
/**
* Cast to stdClass so PHPStan allows dynamic property access.
*
* @var \stdClass $transient
*/
if ( empty( $transient->checked ) || ! is_array( $transient->checked ) ) {
return $transient;
}
if ( empty( $transient->checked[ $this->plugin_basename ] ) ) {
return $transient;
}
$current_version = $transient->checked[ $this->plugin_basename ];
if ( ! is_string( $current_version ) ) {
return $transient;
}
$remote = $this->get_remote_data();
if ( empty( $remote['version'] ) || empty( $remote['download_url'] ) ) {
return $transient;
}
if ( ! $this->is_compatible( $remote ) ) {
return $transient;
}
$remote_version = $remote['version'];
if ( ! is_string( $remote_version ) ) {
return $transient;
}
if ( version_compare( $remote_version, $current_version, '>' ) ) {
$update = (object) array(
'slug' => $remote['slug'] ?? $this->plugin_slug,
'plugin' => $this->plugin_basename,
'new_version' => $remote['version'],
'url' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '',
'package' => $remote['download_url'],
'tested' => $remote['tested'] ?? '',
'requires' => $remote['requires'] ?? '',
'requires_php' => $remote['requires_php'] ?? '',
);
$transient->response[ $this->plugin_basename ] = $update;
}
return $transient;
}
/**
* Provide "View details" modal content.
*
* @param false|object|array<string, mixed> $result The result object or array.
* @param string $action The type of information being requested.
* @param object $args Plugin API arguments.
*
* @return false|object|array<string, mixed> The plugin information object or false.
*/
public function provide_plugin_details( $result, string $action, object $args ) {
if ( 'plugin_information' !== $action ) {
return $result;
}
if ( empty( $args->slug ) || $args->slug !== $this->plugin_slug ) {
return $result;
}
$remote = $this->get_remote_data();
if ( empty( $remote['version'] ) ) {
return $result;
}
return (object) array(
'name' => $remote['name'] ?? $this->plugin_data['Name'] ?? $this->plugin_slug,
'slug' => $remote['slug'] ?? $this->plugin_slug,
'version' => $remote['version'],
'author' => $remote['author'] ?? $this->plugin_data['Author'] ?? '',
'homepage' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '',
'requires' => $remote['requires'] ?? '',
'tested' => $remote['tested'] ?? '',
'requires_php' => $remote['requires_php'] ?? '',
'sections' => array(
'description' => $remote['description'] ?? $this->plugin_data['Description'] ?? '',
'changelog' => $remote['changelog'] ?? '',
),
'download_link' => $remote['download_url'] ?? '',
);
}
/**
* Get remote data with caching and HMAC signature verification.
*
* @return array<string, mixed> Remote data.
*/
private function get_remote_data(): array {
$cached = get_site_transient( $this->cache_key );
// Verify HMAC signature if AUTH_SALT is defined and cache has signature.
if ( false !== $cached && defined( 'AUTH_SALT' ) && '' !== AUTH_SALT ) {
if ( is_array( $cached ) && isset( $cached['signature'], $cached['data'] ) ) {
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize -- serialize() is only used to build an HMAC signature of our own internal cache data; no untrusted input is unserialized.
$expected_sig = hash_hmac( 'sha256', $this->cache_key . serialize( $cached['data'] ), AUTH_SALT );
if ( hash_equals( $expected_sig, $cached['signature'] ) ) {
// Signature valid, return data.
return is_array( $cached['data'] ) ? $cached['data'] : array();
}
// Signature invalid, delete corrupted cache.
delete_site_transient( $this->cache_key );
$cached = false;
}
}
// If no valid cache, fetch fresh data.
if ( false === $cached ) {
$remote = $this->fetch_json();
// Store with HMAC signature if AUTH_SALT is available.
if ( defined( 'AUTH_SALT' ) && '' !== AUTH_SALT ) {
$remote_data = $remote;
$payload = array(
'data' => $remote_data,
'timestamp' => time(),
'signature' => hash_hmac( 'sha256', $this->cache_key . serialize( $remote_data ), AUTH_SALT ), // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize -- Only used to compute an HMAC of our own internal cache data; no untrusted input is unserialized.
);
set_site_transient( $this->cache_key, $payload, 6 * HOUR_IN_SECONDS );
} else {
// Fallback to standard caching.
set_site_transient( $this->cache_key, $remote, 6 * HOUR_IN_SECONDS );
}
return $remote;
}
// Legacy cache format without signature (backward compatibility).
return is_array( $cached ) ? $cached : array();
}
/**
* Fetch JSON from remote URL.
*
* @return array<string, mixed> Decoded JSON data.
*/
private function fetch_json(): array {
$response = wp_remote_get(
$this->json_url,
array(
'timeout' => 10,
'headers' => array(
'Accept' => 'application/json',
),
)
);
if ( is_wp_error( $response ) ) {
return array();
}
$code = (int) wp_remote_retrieve_response_code( $response );
if ( $code < 200 || $code >= 300 ) {
return array();
}
$body = wp_remote_retrieve_body( $response );
$data = json_decode( $body, true );
return is_array( $data ) ? $data : array();
}
/**
* Check compatibility.
*
* @param array<string, mixed> $remote Remote data.
*
* @return bool True if compatible.
*/
private function is_compatible( array $remote ): bool {
if ( ! empty( $remote['requires_php'] ) ) {
$requires_php = $remote['requires_php'];
if ( is_string( $requires_php ) && version_compare( PHP_VERSION, $requires_php, '<' ) ) {
return false;
}
}
if ( ! empty( $remote['requires'] ) ) {
$requires = $remote['requires'];
if ( is_string( $requires ) && version_compare( get_bloginfo( 'version' ), $requires, '<' ) ) {
return false;
}
}
return true;
}
/**
* Handle manual cache clear via URL parameter.
*/
public function handle_cache_clear(): void {
// Check if this is a cache clear request first.
$clear_cache = filter_input( INPUT_GET, 'robotstxt_clear_update_cache', FILTER_UNSAFE_RAW );
if ( null === $clear_cache ) {
return;
}
// This is a cache clear request - now verify nonce.
$nonce_raw = filter_input( INPUT_GET, '_wpnonce', FILTER_UNSAFE_RAW );
$nonce = $nonce_raw ? sanitize_text_field( wp_unslash( $nonce_raw ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'robotstxt_clear_update_cache' ) ) {
wp_die( esc_html__( 'Security check failed', 'robotstxt-smtp' ) );
}
// Check permissions.
if ( ! current_user_can( 'update_plugins' ) ) {
wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'robotstxt-smtp' ) );
}
$this->clear_cache();
wp_safe_redirect( remove_query_arg( array( 'robotstxt_clear_update_cache', '_wpnonce' ) ) );
exit;
}
/**
* Clear update cache.
*/
public function clear_cache(): void {
delete_site_transient( $this->cache_key );
delete_site_transient( 'update_plugins' );
}
}
}

View file

@ -90,6 +90,16 @@ class Plugin {
return self::$instance;
}
/**
* URL of the Manager (by ROBOTSTXT) plugin page.
*/
public const MANAGER_PLUGIN_URL = 'https://www.robotstxt.software/plugins/robotstxt-manager/';
/**
* User meta key used to store the manager notice dismissal.
*/
public const MANAGER_NOTICE_DISMISSED_KEY = 'robotstxt_smtp_manager_notice_dismissed';
/**
* Determines whether the Amazon SES integration plugin is active.
*
@ -106,11 +116,36 @@ class Plugin {
return (bool) \apply_filters( 'robotstxt_smtp_amazon_ses_active', false );
}
/**
* Sets up the plugin.
*
* @return void
*/
/**
* Determines whether the Manager (by ROBOTSTXT) plugin is active.
*
* Updates for this plugin are delivered through the Manager plugin, so its
* presence is required to receive new versions.
*
* @since 2.2.4
*
* @return bool True when the Manager plugin is installed and active.
*/
public static function is_manager_plugin_active(): bool {
$active = array_merge(
(array) get_option( 'active_plugins', array() ),
array_keys( (array) get_site_option( 'active_sitewide_plugins', array() ) )
);
foreach ( $active as $basename ) {
if ( is_string( $basename ) && str_starts_with( $basename, 'robotstxt-manager/' ) ) {
return true;
}
}
return false;
}
/**
* Sets up the plugin.
*
* @return void
*/
public function run(): void {
add_action( 'phpmailer_init', array( $this, 'configure_phpmailer' ) );
add_filter( 'pre_wp_mail', array( $this, 'pre_wp_mail_rate_limit_check' ), 1 );
@ -134,8 +169,11 @@ class Plugin {
if ( is_admin() ) {
add_action( 'admin_init', array( $this, 'migrate_plaintext_credentials' ) );
add_action( 'admin_init', array( $this, 'handle_encryption_notice_dismissal' ) );
add_action( 'admin_init', array( $this, 'handle_manager_notice_dismissal' ) );
add_action( 'admin_notices', array( $this, 'display_encryption_unavailable_notice' ) );
add_action( 'network_admin_notices', array( $this, 'display_encryption_unavailable_notice' ) );
add_action( 'admin_notices', array( $this, 'display_manager_notice' ) );
add_action( 'network_admin_notices', array( $this, 'display_manager_notice' ) );
$this->register_admin();
}
}
@ -555,6 +593,95 @@ class Plugin {
exit;
}
/**
* Displays an admin notice on the plugins list pages when the Manager plugin is missing.
*
* Updates for this plugin are delivered through the Manager (by ROBOTSTXT)
* plugin. When it is not active, a dismissible notice is shown on the site
* and network plugins list pages.
*
* @since 2.2.4
*
* @return void
*/
public function display_manager_notice(): void {
$screen = get_current_screen();
if ( null === $screen || ! in_array( $screen->id, array( 'plugins', 'plugins-network' ), true ) ) {
return;
}
if ( self::is_manager_plugin_active() ) {
return;
}
if ( get_user_meta( get_current_user_id(), self::MANAGER_NOTICE_DISMISSED_KEY, true ) ) {
return;
}
$dismiss_url = wp_nonce_url(
add_query_arg( 'robotstxt_smtp_dismiss_manager_notice', '1' ),
'robotstxt_smtp_dismiss_manager_notice'
);
?>
<div class="notice notice-warning">
<p>
<strong><?php esc_html_e( 'SMTP (by ROBOTSTXT)', 'robotstxt-smtp' ); ?></strong>
</p>
<p>
<?php
printf(
/* translators: %s: Manager plugin page link. */
esc_html__( 'To receive updates for this plugin, the %s plugin must be installed and active.', 'robotstxt-smtp' ),
'<a href="' . esc_url( self::MANAGER_PLUGIN_URL ) . '">' . esc_html__( 'Manager (by ROBOTSTXT)', 'robotstxt-smtp' ) . '</a>'
);
?>
</p>
<p>
<a href="<?php echo esc_url( $dismiss_url ); ?>" class="button button-secondary">
<?php esc_html_e( 'Dismiss', 'robotstxt-smtp' ); ?>
</a>
</p>
</div>
<?php
}
/**
* Handles dismissal of the missing Manager plugin notice.
*
* Stores a per-user preference so the notice is not shown again on the
* plugins list pages until the preference is cleared.
*
* @since 2.2.4
*
* @return void
*/
public function handle_manager_notice_dismissal(): void {
$dismiss_action = filter_input( INPUT_GET, 'robotstxt_smtp_dismiss_manager_notice', FILTER_UNSAFE_RAW );
if ( '1' !== $dismiss_action ) {
return;
}
// Verify nonce.
$nonce_raw = filter_input( INPUT_GET, '_wpnonce', FILTER_UNSAFE_RAW );
$nonce = $nonce_raw ? sanitize_text_field( wp_unslash( $nonce_raw ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'robotstxt_smtp_dismiss_manager_notice' ) ) {
return;
}
// Check capability.
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
update_user_meta( get_current_user_id(), self::MANAGER_NOTICE_DISMISSED_KEY, '1' );
// Redirect to clean URL.
$redirect_url = remove_query_arg( array( 'robotstxt_smtp_dismiss_manager_notice', '_wpnonce' ) );
wp_safe_redirect( $redirect_url );
exit;
}
/**
* Configures PHPMailer to use the stored SMTP settings.
*

View file

@ -1093,6 +1093,7 @@ class Settings_Page {
?>
<div class="wrap">
<h1><?php echo esc_html__( 'SMTP (by ROBOTSTXT)', 'robotstxt-smtp' ); ?></h1>
<?php $this->render_manager_plugin_notice(); ?>
<form action="<?php echo esc_url( admin_url( 'options.php' ) ); ?>" method="post">
<?php
settings_fields( self::SITE_SETTINGS_GROUP );
@ -1134,11 +1135,43 @@ class Settings_Page {
<?php
}
/**
* Renders the settings page shown in the network admin area.
*
* @return void
*/
/**
* Renders a non-dismissible inline notice when the Manager plugin is missing.
*
* Updates for this plugin are delivered through the Manager (by ROBOTSTXT)
* plugin, so settings pages warn the administrator while it is not active.
*
* @since 2.2.4
*
* @return void
*/
private function render_manager_plugin_notice(): void {
if ( Plugin::is_manager_plugin_active() ) {
return;
}
?>
<div class="notice notice-warning inline">
<p>
<strong><?php esc_html_e( 'SMTP (by ROBOTSTXT)', 'robotstxt-smtp' ); ?></strong>
</p>
<p>
<?php
printf(
/* translators: %s: Manager plugin page link. */
esc_html__( 'To receive updates for this plugin, the %s plugin must be installed and active.', 'robotstxt-smtp' ),
'<a href="' . esc_url( Plugin::MANAGER_PLUGIN_URL ) . '">' . esc_html__( 'Manager (by ROBOTSTXT)', 'robotstxt-smtp' ) . '</a>'
);
?>
</p>
</div>
<?php
}
/**
* Renders the settings page shown in the network admin area.
*
* @return void
*/
public function render_network_settings_page(): void {
$this->ensure_capability( self::SCOPE_NETWORK );
$this->set_scope( self::SCOPE_NETWORK );
@ -1148,6 +1181,7 @@ class Settings_Page {
?>
<div class="wrap">
<h1><?php echo esc_html__( 'SMTP (by ROBOTSTXT)', 'robotstxt-smtp' ); ?></h1>
<?php $this->render_manager_plugin_notice(); ?>
<?php
$saved_notice_raw = filter_input( INPUT_GET, 'robotstxt_smtp_saved', FILTER_UNSAFE_RAW );

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
=== SMTP (by ROBOTSTXT) ===
Contributors: javiercasares
Contributors: robotstxt, javiercasares
Tags: smtp, email, mail
Requires at least: 5.9
Tested up to: 7.1
Stable tag: 2.2.3
Stable tag: 2.2.4
Requires PHP: 8.0
Version: 2.2.3
Version: 2.2.4
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -70,6 +70,25 @@ Yes. From the network dashboard you can decide whether the configuration is glob
== Changelog ==
= 2.2.4 =
_Release date: 2026-08-17_
**Added**
* Dismissible notice on the Plugins pages when the [Manager (by ROBOTSTXT)](https://www.robotstxt.software/plugins/robotstxt-manager/) plugin is not installed and active. The Manager plugin is required to receive updates for this plugin.
* Warning on the plugin settings pages (not dismissible) when the Manager plugin is not active.
**Changed**
* Plugin updates are now delivered through the Manager (by ROBOTSTXT) plugin. The built-in Gitea updater and its `update.json` file were removed.
* New plugin and update URL: https://www.robotstxt.software/plugins/robotstxt-smtp/
**Compatibility**
* WordPress: 5.9 - 7.1
* PHP: 8.0 - 8.5
= 2.2.3 =
_Release date: 2026-06-09_
@ -106,56 +125,9 @@ _Release date: 2026-06-09_
* WordPress: 5.9 - 7.1
* PHP: 8.0 - 8.5
= 2.2.1 =
_Release date: 2026-06-09_
**Fixed**
* Fixed the statistics chart not rendering. Chart.js initialization now uses `wp_add_inline_script()` to guarantee correct script load order.
* Chart.js is now bundled locally — no external CDN requests.
**Compatibility**
* WordPress: 5.9 - 7.1
* PHP: 8.0 - 8.5
= 2.2.0 =
_Release date: 2026-06-09_
**Fixed**
* Fixed passwords with special characters (`<`, `>`, newlines) being silently corrupted on save.
* Fixed credential mask displaying literal text instead of bullet characters in the test email panel.
* Fixed decrypted credentials being stored in temporary transients.
* Fixed DMARC tool: implements RFC 7489 §6.6.3 organizational domain fallback.
* Fixed rate-limit enforcement now short-circuits `wp_mail()` immediately.
* Fixed DKIM/DMARC DNS lookups use the timeout-protected wrapper.
* Fixed rate-limit transients removed on uninstall.
**Compatibility**
* WordPress: 5.9 - 7.1
* PHP: 8.0 - 8.5
= 2.1.0 =
_Release date: 2026-02-09_
**Added**
* Data management option to control whether plugin data is deleted on uninstall (disabled by default).
* Reset plugin data functionality with site-level and network-level support.
**Compatibility**
* WordPress: 6.5 - 6.9
* PHP: 8.2 - 8.4
= Previous versions =
For the full changelog visit [changelog.txt](https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp/raw/branch/main/changelog.txt).
For the full changelog visit the [plugin page](https://www.robotstxt.software/plugins/robotstxt-smtp/).
== Compliance ==

View file

@ -1,21 +1,20 @@
<?php
/**
* Plugin Name: SMTP (by ROBOTSTXT)
* Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp
* Plugin URI: https://www.robotstxt.software/plugins/robotstxt-smtp/
* Description: Configure WordPress to send emails through SMTP with detailed controls.
* Version: 2.2.3
* Version: 2.2.4
* Requires at least: 5.9
* Requires PHP: 8.0
* Network: true
* Security: robotstxt@robotstxt.es
* Author: ROBOTSTXT
* Author URI: https://www.robotstxt.es/
* Author URI: https://www.robotstxt.software/
* Text Domain: robotstxt-smtp
* Domain Path: /languages
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Gitea Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp
* Primary Branch: main
* Update URI: https://www.robotstxt.software/plugins/robotstxt-smtp/
*
* @package Robotstxt_SMTP
*/
@ -25,7 +24,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
if ( ! defined( 'ROBOTSTXT_SMTP_VERSION' ) ) {
define( 'ROBOTSTXT_SMTP_VERSION', '2.2.3' );
define( 'ROBOTSTXT_SMTP_VERSION', '2.2.4' );
}
if ( ! defined( 'ROBOTSTXT_SMTP_FILE' ) ) {
@ -125,7 +124,3 @@ if ( robotstxt_smtp_dependencies_satisfied() ) {
} else {
robotstxt_smtp_register_dependency_notice();
}
// Initialize ROBOTSTXT updater (auto-configures from plugin headers).
require_once __DIR__ . '/class-robotstxt-updater.php';
Robotstxt_Updater::init( __FILE__ );

View file

@ -64,16 +64,6 @@ if ( ! function_exists( 'robotstxt_smtp_uninstall_cleanup_site' ) ) {
// Delete Amazon SES transients.
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_amazonses_quota_', false );
// Delete updater cache transients for all plugins.
$plugin_basenames = array(
'robotstxt-smtp/robotstxt-smtp.php',
'robotstxt-smtp-amazonses/robotstxt-smtp-amazonses.php',
'robotstxt-smtp-newsletter/robotstxt-smtp-newsletter.php',
);
foreach ( $plugin_basenames as $basename ) {
delete_transient( 'robotstxt_updater_' . md5( $basename ) );
}
// Clear scheduled cron hooks.
wp_clear_scheduled_hook( 'robotstxt_smtp_cleanup_logs' );
wp_clear_scheduled_hook( 'robotstxt_smtp_cleanup_stats' );
@ -102,16 +92,6 @@ if ( ! function_exists( 'robotstxt_smtp_uninstall_cleanup_network' ) ) {
// Delete Amazon SES site transients.
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_amazonses_quota_', true );
// Delete updater cache site transients for all plugins.
$plugin_basenames = array(
'robotstxt-smtp/robotstxt-smtp.php',
'robotstxt-smtp-amazonses/robotstxt-smtp-amazonses.php',
'robotstxt-smtp-newsletter/robotstxt-smtp-newsletter.php',
);
foreach ( $plugin_basenames as $basename ) {
delete_site_transient( 'robotstxt_updater_' . md5( $basename ) );
}
// Clear WordPress update cache.
delete_site_transient( 'update_plugins' );
}
@ -251,3 +231,6 @@ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
// Drop the statistics table (global, only once).
robotstxt_smtp_uninstall_delete_statistics_table();
// Delete the per-user manager notice dismissal preference (global, only once).
delete_metadata( 'user', 0, 'robotstxt_smtp_manager_notice_dismissed', '', true );

View file

@ -1,8 +1,8 @@
{
"name": "SMTP (by ROBOTSTXT)",
"slug": "robotstxt-smtp",
"version": "2.2.3",
"download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp/releases/download/2.2.3/robotstxt-smtp-2.2.3.zip",
"version": "2.2.4",
"download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp/releases/download/2.2.4/robotstxt-smtp-2.2.4.zip",
"requires": "5.9",
"requires_php": "8.0",
"tested": "7.1",
@ -11,10 +11,10 @@
"author_profile": "https://www.robotstxt.es/",
"homepage": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp",
"description": "Configure WordPress to send emails through SMTP with detailed controls. Supports multiple SMTP providers, logging, diagnostics, and network/site-level configuration.",
"changelog": "<h3>2.2.3 - 2026-06-09</h3><ul><li><strong>Fixed:</strong> DKIM selector form submitted to a non-existent page slug in Network Admin (robotstxt-smtp-network-tools instead of robotstxt-smtp-tools)</li></ul><h3>2.2.2 - 2026-06-09</h3><ul><li><strong>Fixed:</strong> From Email and Reply-To Email not clearing when submitted empty</li><li><strong>Fixed:</strong> Clear password button had no effect (sanitize_option callback re-applied old password)</li><li><strong>Fixed:</strong> Clear password link submitted to options.php (nested form issue)</li><li><strong>Fixed:</strong> DKIM Try Selector button did nothing (wp_kses_post stripped form elements)</li><li><strong>Fixed:</strong> Spamhaus ZEN false &quot;Listed&quot; result for 127.255.255.254 (open-resolver error code)</li><li><strong>Added:</strong> DKIM selector auto-detection from MX records (Google Workspace, Microsoft 365, Zoho, ProtonMail, iCloud, Aruba, Mailchimp)</li><li><strong>Added:</strong> &quot;Try a specific selector&quot; input in Tools — Authentication</li><li><strong>Added:</strong> Password field placeholder is now context-aware</li></ul><h3>2.2.1 - 2026-06-09</h3><ul><li><strong>Fixed:</strong> Statistics chart not rendering due to script load-order issue</li><li><strong>Fixed:</strong> Chart.js now bundled locally — no external CDN requests</li></ul><h3>2.2.0 - 2026-06-09</h3><ul><li><strong>Security:</strong> Fixed passwords with special characters being silently corrupted on save</li><li><strong>Security:</strong> Fixed credentials no longer stored in transients after test email</li><li><strong>Security:</strong> Fixed credential mask bug in test email panel</li><li><strong>Fixed:</strong> DMARC tool now implements RFC 7489 §6.6.3 organizational domain fallback</li><li><strong>Fixed:</strong> Rate-limit enforcement now short-circuits wp_mail() immediately</li><li><strong>Fixed:</strong> DKIM and DMARC DNS lookups use timeout-protected wrapper</li><li><strong>Fixed:</strong> Rate-limit transients removed on uninstall</li><li><strong>Compatibility:</strong> WordPress minimum lowered to 5.9</li><li><strong>Compatibility:</strong> PHP minimum lowered to 8.0</li></ul><h3>2.1.0 - 2026-02-09</h3><ul><li><strong>Added:</strong> Data management option to control whether plugin data is deleted on uninstall (disabled by default for data preservation)</li><li><strong>Added:</strong> Reset plugin data functionality with site-level and network-level support</li><li><strong>Added:</strong> Unified uninstall cleanup system that handles all add-on data (Amazon SES, Newsletter)</li><li><strong>Added:</strong> Automatic password clearing when both host and username fields are empty to prevent orphaned credentials</li><li><strong>Changed:</strong> Uninstall behavior now respects user preference: data is preserved by default unless explicitly enabled</li><li><strong>Changed:</strong> Add-on plugins (Amazon SES, Newsletter) no longer perform cleanup on uninstall - all cleanup is centralized in the core plugin</li></ul>",
"changelog": "",
"sections": {
"description": "Configure WordPress to send emails through SMTP with detailed controls. Supports multiple SMTP providers, logging, diagnostics, and network/site-level configuration.",
"changelog": "<h3>2.2.3 - 2026-06-09</h3><ul><li><strong>Fixed:</strong> DKIM selector form submitted to a non-existent page slug in Network Admin (robotstxt-smtp-network-tools instead of robotstxt-smtp-tools)</li></ul><h3>2.2.2 - 2026-06-09</h3><ul><li><strong>Fixed:</strong> From Email and Reply-To Email not clearing when submitted empty</li><li><strong>Fixed:</strong> Clear password button had no effect (sanitize_option callback re-applied old password)</li><li><strong>Fixed:</strong> Clear password link submitted to options.php (nested form issue)</li><li><strong>Fixed:</strong> DKIM Try Selector button did nothing (wp_kses_post stripped form elements)</li><li><strong>Fixed:</strong> Spamhaus ZEN false &quot;Listed&quot; result for 127.255.255.254 (open-resolver error code)</li><li><strong>Added:</strong> DKIM selector auto-detection from MX records (Google Workspace, Microsoft 365, Zoho, ProtonMail, iCloud, Aruba, Mailchimp)</li><li><strong>Added:</strong> &quot;Try a specific selector&quot; input in Tools — Authentication</li><li><strong>Added:</strong> Password field placeholder is now context-aware</li></ul><h3>2.2.1 - 2026-06-09</h3><ul><li><strong>Fixed:</strong> Statistics chart not rendering due to script load-order issue</li><li><strong>Fixed:</strong> Chart.js now bundled locally — no external CDN requests</li></ul><h3>2.2.0 - 2026-06-09</h3><ul><li><strong>Security:</strong> Fixed passwords with special characters being silently corrupted on save</li><li><strong>Security:</strong> Fixed credentials no longer stored in transients after test email</li><li><strong>Security:</strong> Fixed credential mask bug in test email panel</li><li><strong>Fixed:</strong> DMARC tool now implements RFC 7489 §6.6.3 organizational domain fallback</li><li><strong>Fixed:</strong> Rate-limit enforcement now short-circuits wp_mail() immediately</li><li><strong>Fixed:</strong> DKIM and DMARC DNS lookups use timeout-protected wrapper</li><li><strong>Fixed:</strong> Rate-limit transients removed on uninstall</li><li><strong>Compatibility:</strong> WordPress minimum lowered to 5.9</li><li><strong>Compatibility:</strong> PHP minimum lowered to 8.0</li></ul><h3>2.1.0 - 2026-02-09</h3><ul><li><strong>Added:</strong> Data management option to control whether plugin data is deleted on uninstall (disabled by default for data preservation)</li><li><strong>Added:</strong> Reset plugin data functionality with site-level and network-level support</li><li><strong>Added:</strong> Unified uninstall cleanup system that handles all add-on data (Amazon SES, Newsletter)</li><li><strong>Added:</strong> Automatic password clearing when both host and username fields are empty to prevent orphaned credentials</li><li><strong>Changed:</strong> Uninstall behavior now respects user preference: data is preserved by default unless explicitly enabled</li><li><strong>Changed:</strong> Add-on plugins (Amazon SES, Newsletter) no longer perform cleanup on uninstall - all cleanup is centralized in the core plugin</li></ul>"
"changelog": ""
},
"banners": {
"low": "",