=== FluentColdMail - SMTP Rotation for FluentCRM ===
Contributors: techcreative
Tags: smtp, email, fluentcrm, cold email, rotation
Requires at least: 5.0
Tested up to: 6.8
Requires PHP: 7.3
Stable tag: 1.0.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Advanced SMTP rotation plugin for FluentCRM cold email campaigns. Manage multiple SMTP accounts with daily sending limits and automatic rotation.

== Description ==

FluentColdMail is a powerful addon for FluentCRM that enables you to send cold emails using multiple SMTP accounts with intelligent rotation strategies.

= Key Features =

* **Multiple SMTP Account Management** - Add and manage unlimited SMTP accounts from different providers
* **Intelligent Rotation** - Choose from multiple rotation strategies (Round Robin, Random, Domain Limit)
* **Daily Sending Limits** - Set and enforce daily sending limits per account to stay within provider restrictions
* **Domain-Based Rotation** - Configure maximum accounts per domain per day for optimal deliverability
* **Comprehensive Logging** - Track every email sent with detailed logs and statistics
* **Real-Time Monitoring** - Dashboard showing account usage, email statistics, and account status
* **Secure Password Storage** - Encrypted password storage using OpenSSL
* **FluentCRM Integration** - Seamlessly integrates with FluentCRM email sending

= Rotation Strategies =

**Round Robin**: Cycles through accounts sequentially based on priority, ensuring even distribution of emails across all accounts.

**Random**: Randomly selects an available account from the pool, providing unpredictable rotation patterns.

**Domain Limit**: Limits the number of accounts from the same domain used per day, helping maintain sender reputation.

= Perfect For =

* Cold email campaigns
* High-volume email marketing
* Multi-domain email sending
* Email deliverability optimization
* Sender reputation management

= Requirements =

* FluentCRM plugin (free or pro)
* WordPress 5.0 or higher
* PHP 7.3 or higher

== Installation ==

1. Install and activate FluentCRM plugin
2. Upload the FluentColdMail plugin to the `/wp-content/plugins/` directory
3. Activate the plugin through the 'Plugins' menu in WordPress
4. Go to Cold Mail > Settings to configure rotation settings
5. Add your SMTP accounts in Cold Mail > SMTP Accounts
6. Start sending emails through FluentCRM!

== Frequently Asked Questions ==

= Does this plugin work without FluentCRM? =

No, FluentColdMail is an addon for FluentCRM and requires FluentCRM to be installed and activated.

= How many SMTP accounts can I add? =

You can add unlimited SMTP accounts. The plugin is designed to handle multiple accounts efficiently.

= Will this affect other WordPress emails? =

No, FluentColdMail only affects emails sent through FluentCRM campaigns and automations. Other WordPress emails remain unaffected.

= How are passwords stored? =

Passwords are encrypted using OpenSSL (AES-256-CBC) for maximum security.

= Can I use different SMTP providers? =

Yes! You can use any SMTP provider including Gmail, SendGrid, Amazon SES, Mailgun, and custom SMTP servers.

= What happens when daily limit is reached? =

When an account reaches its daily limit, the rotation engine automatically selects the next available account. If all accounts are at their limits, the email will fail and be logged.

= How do I check email logs? =

Go to Cold Mail > Logs to view comprehensive email logs including sent/failed status, timestamps, and error messages.

== Screenshots ==

1. Dashboard showing account statistics and usage
2. SMTP Accounts management page
3. Email logs with filtering options
4. Settings page with rotation strategies

== Changelog ==

= 1.0.5 =
* Fixed: Stats counter not updating on dashboard (email logs were failing silently)
* Added: Automatic database migration to add missing columns (body_content, subject)
* Added: "Test Email Logging" diagnostic button in Settings > Database Tools
* Added: Current database values display in Human-like Email Delay settings
* Fixed: Human delay settings not being applied due to WordPress object cache
* Improved: Enhanced error logging for email logging failures with detailed diagnostics
* Improved: Data truncation to prevent insert failures (email 255 chars, subject 500 chars)
* Improved: Auto table creation check before logging emails
* Improved: Null-safe stats retrieval on dashboard

= 1.0.4 =
* Restructured: Content variations now use paired subject+body structure for better A/B testing
* Added: Each variation now contains subject, body, and one weight in a single card
* Improved: Variation selection ensures subject and body always match by variation number
* Improved: Simplified variation management UI with combined subject+body fields
* Improved: Better variation explanations and examples in UI
* Fixed: SMTP authentication issue caused by database update logging during initialization
* Fixed: Automatic database updates now run silently on plugin load

= 1.0.2 =
* Added: Email body content storage in database for better debugging
* Added: "View Content" button in email logs to display full email subject and body
* Added: Automatic log cleanup with configurable retention periods (7, 14, 30, 60, 90, 365 days)
* Added: Daily cron job to automatically clean up old email logs
* Improved: Enhanced email error logging with detailed information
* Improved: Content variations saving with better feedback and error handling
* Improved: Retry queue error tracking with exception handling
* Fixed: Better error messages for failed retry attempts

= 1.0.1 =
* Fixed: WordPress 6.9 compatibility for envelope sender handling
* Added: Content variations/spintax feature for email campaigns
* Added: Manual variations support for specific campaigns
* Improved: SMTP configuration handling for better deliverability

= 1.0.0 =
* Initial release
* Multiple SMTP account support
* Three rotation strategies (Round Robin, Random, Domain Limit)
* Daily sending limits per account
* Comprehensive email logging
* Dashboard with statistics
* FluentCRM integration
* Secure password encryption
* Debug logging

== Upgrade Notice ==

= 1.0.5 =
Critical bug fixes for stats tracking and email logging. Includes automatic database migration and diagnostic tools. Human delay settings now properly applied.

= 1.0.4 =
Major improvement to content variations - subject and body are now paired together for better A/B testing. SMTP authentication fix included.

= 1.0.2 =
Added email content viewing in logs, automatic log cleanup, and improved error handling.

= 1.0.1 =
WordPress 6.9 compatibility and content variations feature.

= 1.0.0 =
Initial release of FluentColdMail.

== Support ==

For support, please visit [TechCreative Support](https://techcreative.dev)

== Developer Notes ==

= Hooks and Filters =

FluentColdMail provides several hooks for developers:

* `fluentcoldmail_loaded` - Fires when plugin is loaded
* `fluentcoldmail_activated` - Fires on plugin activation
* `fluentcoldmail_deactivated` - Fires on plugin deactivation
* `fluentcoldmail_is_fluentcrm_email` - Filter to identify FluentCRM emails

= Functions =

* `fcm_get_account($account_id)` - Get SMTP account by ID
* `fcm_get_accounts($args)` - Get all SMTP accounts
* `fcm_get_daily_usage($account_id, $date)` - Get account daily usage
* `fcm_can_send($account_id)` - Check if account can send
* `fcm_get_logs($args)` - Get email logs
* `fcm_get_stats($args)` - Get email statistics

== Privacy Policy ==

FluentColdMail stores email logs including recipient email addresses for monitoring purposes. This data is stored in your WordPress database and is not shared with any third parties. SMTP credentials are encrypted and stored securely.
