From 97ed06ef72514430de9a08b7984097040c5da0c3 Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Wed, 18 Feb 2026 16:05:11 +0000 Subject: [PATCH] v2.2.4 --- changelog.txt | 7 +++++++ includes/class-plugin.php | 25 ++++++++++++++++++------- readme.txt | 11 ++++++++++- robotstxt-smtp-newsletter.php | 4 ++-- update.json | 10 +++++----- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index d9c7fa2..fa8ef3f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ += 2.2.4 = + +* CRITICAL FIX: Speed calculation now uses actual NEWSLETTER_CRON_INTERVAL value +* FIXED: Batch_size was being divided by 5 due to incorrect cron interval assumption +* IMPROVED: Plugin now dynamically calculates speed based on actual Newsletter cron interval +* IMPROVED: Supports any cron interval (60s, 300s, etc.) without hardcoded assumptions + = 2.2.3 = * CRITICAL FIX: Overridden get_emails_per_run() to bypass Newsletter's internal calculation diff --git a/includes/class-plugin.php b/includes/class-plugin.php index 406a102..8d8b5b4 100644 --- a/includes/class-plugin.php +++ b/includes/class-plugin.php @@ -195,13 +195,24 @@ class Plugin extends \NewsletterMailerAddon { $speed = $this->calculate_optimal_speed( $smtp_settings ); // CRITICAL: For queue-based architecture, speed must be high enough - // that Newsletter loads all emails at once. Newsletter calculates - // batch_size = speed / (60 / cron_interval). With default 5-minute cron: - // batch_size = speed / 12. To get batch_size = configured value, - // we need: speed = batch_size * 12. - $batch_size = $settings['batch_size'] ?? 10; - $speed_multiplier = 12; // Assumes 5-minute cron (12 executions per hour). - $calculated_speed = max( $speed, $batch_size * $speed_multiplier ); + // that Newsletter loads all emails at once. Newsletter calculates: + // batch_size = speed / (3600 / NEWSLETTER_CRON_INTERVAL) + // To get batch_size = configured value, we need: + // speed = batch_size * (3600 / NEWSLETTER_CRON_INTERVAL) + $batch_size = $settings['batch_size'] ?? 10; + + // Ensure NEWSLETTER_CRON_INTERVAL is loaded + if ( ! defined( 'NEWSLETTER_CRON_INTERVAL' ) ) { + $cron_file = WP_PLUGIN_DIR . '/newsletter/includes/cron.php'; + if ( file_exists( $cron_file ) ) { + require_once $cron_file; + } + } + + // Calculate runs per hour based on Newsletter's cron interval + $cron_interval = defined( 'NEWSLETTER_CRON_INTERVAL' ) ? NEWSLETTER_CRON_INTERVAL : 300; + $runs_per_hour = (int) ( 3600 / $cron_interval ); + $calculated_speed = max( $speed, $batch_size * $runs_per_hour ); // Newsletter expects 'turbo' for batch_size and 'speed' for emails/hour. $mailer_options = array( diff --git a/readme.txt b/readme.txt index 5ad8569..a90eee4 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: newsletter, smtp, email, bulk, queue, worker, amazonses, statistics Requires at least: 4.7 Tested up to: 6.9 Requires PHP: 7.2 -Stable tag: 2.2.3 +Stable tag: 2.2.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -141,6 +141,12 @@ Yes. The plugin integrates with ROBOTSTXT SMTP rate limiting system to ensure yo == Changelog == += 2.2.4 = +* CRITICAL FIX: Speed calculation now uses actual NEWSLETTER_CRON_INTERVAL value +* FIXED: Batch_size was being divided by 5 due to incorrect cron interval assumption +* IMPROVED: Plugin now dynamically calculates speed based on actual Newsletter cron interval +* IMPROVED: Supports any cron interval (60s, 300s, etc.) without hardcoded assumptions + = 2.2.3 = * CRITICAL FIX: Overridden get_emails_per_run() to bypass Newsletter's internal calculation * FIXED: Newsletter was calculating batch = speed / 12, resulting in only 8-16 emails per execution @@ -185,6 +191,9 @@ Yes. The plugin integrates with ROBOTSTXT SMTP rate limiting system to ensure yo == Upgrade Notice == += 2.2.4 = +CRITICAL: Fixed speed calculation to work with any Newsletter cron interval. Resolves batch_size division issues. + = 2.2.3 = CRITICAL: Fixed Newsletter loading only 8-16 emails per execution. Now correctly loads all emails based on configured batch_size. diff --git a/robotstxt-smtp-newsletter.php b/robotstxt-smtp-newsletter.php index 949ee33..bfd98d9 100644 --- a/robotstxt-smtp-newsletter.php +++ b/robotstxt-smtp-newsletter.php @@ -3,7 +3,7 @@ * Plugin Name: Newsletter - SMTP (by ROBOTSTXT) * Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp-newsletter * Description: Integrates ROBOTSTXT SMTP configuration with Newsletter plugin for efficient bulk email delivery with database-backed queue and external workers. - * Version: 2.2.3 + * Version: 2.2.4 * Requires at least: 4.7 * Requires PHP: 7.2 * Security: robotstxt@robotstxt.es @@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) { } // Plugin constants. -define( 'ROBOTSTXT_SMTP_NEWSLETTER_VERSION', '2.2.3' ); +define( 'ROBOTSTXT_SMTP_NEWSLETTER_VERSION', '2.2.4' ); define( 'ROBOTSTXT_SMTP_NEWSLETTER_FILE', __FILE__ ); define( 'ROBOTSTXT_SMTP_NEWSLETTER_PATH', plugin_dir_path( __FILE__ ) ); define( 'ROBOTSTXT_SMTP_NEWSLETTER_URL', plugin_dir_url( __FILE__ ) ); diff --git a/update.json b/update.json index a1423ce..dba7501 100644 --- a/update.json +++ b/update.json @@ -1,19 +1,19 @@ { "name": "Newsletter - SMTP (by ROBOTSTXT)", "slug": "robotstxt-smtp-newsletter", - "version": "2.2.3", + "version": "2.2.4", "author": "ROBOTSTXT", "homepage": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp-newsletter", - "download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp-newsletter/releases/download/2.2.3/robotstxt-smtp-newsletter-2.2.3.zip", + "download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-smtp-newsletter/releases/download/2.2.4/robotstxt-smtp-newsletter-2.2.4.zip", "requires": "4.7", "tested": "6.9", "requires_php": "7.2", "last_updated": "2026-02-16", "description": "Integrates ROBOTSTXT SMTP configuration with Newsletter plugin for reliable bulk email delivery with database-backed queue and external workers. Provides persistent email queue, parallel processing, automatic retry, and comprehensive campaign statistics.", - "changelog": "

2.2.3 - 2026-02-16

2.2.2 - 2026-02-16

2.2.1 - 2026-02-16

2.2.0 - 2026-02-16

2.1.0 - 2026-02-09

2.0.1 - 2026-01-29

2.0.0 - 2026-01-29

1.0.0 - 2026-01-29

", + "changelog": "

2.2.4 - 2026-02-16

2.2.3 - 2026-02-16

2.2.2 - 2026-02-16

2.2.1 - 2026-02-16

2.2.0 - 2026-02-16

2.1.0 - 2026-02-09

2.0.1 - 2026-01-29

2.0.0 - 2026-01-29

1.0.0 - 2026-01-29

", "sections": { - "description": "Integrates ROBOTSTXT SMTP configuration with Newsletter plugin for reliable bulk email delivery with database-backed queue and external workers. Version 2.2.3 fixes critical batch loading issue where Newsletter was only loading 8-16 emails per execution. Emails are queued to database and processed by external CLI workers, providing reliability, scalability, and detailed monitoring.", - "changelog": "

2.2.3 - 2026-02-16

2.2.2 - 2026-02-16

2.2.1 - 2026-02-16

2.2.0 - 2026-02-16

" + "description": "Integrates ROBOTSTXT SMTP configuration with Newsletter plugin for reliable bulk email delivery with database-backed queue and external workers. Version 2.2.4 fixes speed calculation to work correctly with any Newsletter cron interval. Emails are queued to database and processed by external CLI workers, providing reliability, scalability, and detailed monitoring.", + "changelog": "

2.2.4 - 2026-02-16

2.2.3 - 2026-02-16

2.2.2 - 2026-02-16

2.2.1 - 2026-02-16

2.2.0 - 2026-02-16

" }, "banners": { "low": "",