=== Eprimo Mail Radar ===
Contributors: eprimo, orionshariar
Tags: email log, email logger, email monitor, email debug, email tracking
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Track, debug, and resend all WordPress emails. Logs every outgoing email with source detection, live search, privacy controls, and one-click resend.

== Description ==

**Eprimo Mail Radar** tracks every email your WordPress site sends. Know instantly whether emails are delivered or failing — no more guessing.

Perfect for developers, site owners, and agencies who need visibility into WordPress email delivery.

= Why Eprimo Mail Radar? =

WordPress provides no built-in way to know if emails are actually being sent. With Eprimo Mail Radar, you get complete visibility:

* Was the WooCommerce order confirmation delivered?
* Did the contact form submission go through?
* Why is the password reset email failing?
* Which plugin is sending the most emails?

= Key Features =

**📧 Automatic Email Logging**
Every outgoing email is logged automatically — subject, recipient, content, headers, status, and which plugin sent it.

**🔍 Source Detection**
Automatically identifies which plugin or theme triggered the email — WooCommerce, Contact Form 7, Gravity Forms, WordPress core, or any other plugin.

**📎 Attachment Tracking**
Logs attachment filenames, sizes, and file types. Download attachments directly from the email details page.

**⚡ Live AJAX Search**
Search by recipient, subject, or source. Results update instantly as you type — no page reloads.

**📅 Date Range Filter**
Filter emails by date range to find exactly what you need.

**🔄 Resend with Recipient Edit**
Resend any logged email to the original or a different recipient. Edit the recipient address before sending.

**🛡️ Privacy Controls**
GDPR-friendly options to disable content logging, mask recipient addresses, or disable attachment logging.

**🗑️ Bulk Actions**
Delete selected emails, all failed emails, or all sent emails in one click.

**⏰ Auto-Cleanup**
Configure automatic deletion of old logs — 7 days, 30 days, 90 days, or keep forever.

**🎨 Email Preview**
View rendered HTML emails in a secure sandboxed iframe. Toggle between rendered view and source code.

= Works With Everything =

Eprimo Mail Radar works with any plugin or theme that sends emails through WordPress:

* WooCommerce
* Contact Form 7
* Gravity Forms
* WPForms
* Elementor Forms
* BuddyPress
* bbPress
* Easy Digital Downloads
* WP Mail SMTP
* Any SMTP plugin
* Custom plugin emails
* WordPress core emails

= Zero Configuration =

Install, activate, done. Eprimo Mail Radar starts logging immediately with sensible defaults. Configure settings only if you want to.

== Installation ==

= Automatic Installation =

1. Go to **Plugins → Add New** in your WordPress admin
2. Search for **Eprimo Mail Radar**
3. Click **Install Now** and then **Activate**

= Manual Installation =

1. Download the plugin ZIP file
2. Go to **Plugins → Add New → Upload Plugin**
3. Choose the ZIP file and click **Install Now**
4. Activate the plugin

= Getting Started =

After activation, a new **Eprimo Mail Radar** menu appears in your WordPress admin sidebar. The plugin immediately begins logging all outgoing emails. Visit **Eprimo Mail Radar → Settings** to customize logging preferences, privacy controls, and retention periods.

== Frequently Asked Questions ==

= Does this plugin modify or send emails on its own? =

No. Eprimo Mail Radar only observes and logs emails that WordPress sends through the `wp_mail()` function. It never modifies outgoing emails.

= Will this slow down my site? =

No. The logging process adds minimal overhead to the `wp_mail()` function. Database queries are optimized with proper indexes.

= How does source detection work? =

Eprimo Mail Radar uses PHP's debug backtrace to identify which plugin, theme, or WordPress core function triggered the `wp_mail()` call. The source is displayed in the email list and detail views.

= How long are emails stored? =

By default, emails older than 90 days are automatically deleted via WP-Cron. You can change this to 7, 30, or any number of days in Settings. You can also choose to keep logs forever.

= Can I exclude certain emails from being logged? =

Yes. Go to **Eprimo Mail Radar → Settings** and add email addresses (one per line) in the Exclude Email Addresses field.

= Does this work with SMTP plugins? =

Yes. Eprimo Mail Radar hooks into `wp_mail()` which runs regardless of whether you use PHP mail, WP Mail SMTP, Post SMTP, or any other SMTP plugin.

= Can I resend an email to a different address? =

Yes. Click Resend on any email, and a modal lets you edit the recipient address before sending.

= Is this GDPR compliant? =

Eprimo Mail Radar provides privacy controls to disable content logging, mask recipient email addresses, and disable attachment logging. All data is stored locally in your WordPress database — nothing is sent to external servers. Configure these settings according to your privacy requirements.

= Can I see email attachments? =

Attachment filenames, sizes, and file types are logged. If the file still exists on the server, you can download it from the email details page.

= Does this work on WordPress Multisite? =

Currently, Eprimo Mail Radar works on individual sites within a multisite network. Network-wide logging is planned for a future release.

== Screenshots ==

1. **Email List** — View all logged emails with status, source, and date. Hover to see View, Delete, and Resend actions.
2. **Live Search** — Search by recipient, subject, or source with instant results. Filter by date range and status.
3. **Email Detail** — View rendered HTML preview or raw source code. See recipient, sender, source, headers, and attachments.
4. **Resend Modal** — Resend any email to the original or a different recipient.
5. **Settings** — Configure logging, retention, privacy controls, and exclusions.
6. **Statistics** — Quick overview of total, sent, and failed email counts.

== Changelog ==

= 1.0.0 =
* Initial release
* Automatic email logging via wp_mail hook
* Success and failure tracking with error messages
* Source detection — identifies which plugin, theme, or WordPress core sent the email
* Attachment tracking — logs filenames, sizes, and file types with download support
* Live AJAX search — search by recipient, subject, or source without page reload
* Date range filter
* Status filter tabs (All, Sent, Failed) with dynamic counts
* AJAX pagination
* Single email view with sandboxed HTML preview
* Source code view with dark theme
* Resend email with editable recipient via modal
* Individual delete with row animation
* Bulk actions — delete selected, delete all failed, delete all sent
* Privacy controls — disable content logging, mask recipients, disable attachment logging
* Auto-cleanup via WP-Cron with configurable retention days
* Keep forever option for retention
* Exclude specific email addresses from logging
* Email statistics dashboard
* WordPress native row actions UI
* Translation ready with text domain eprimo-mail-radar
* Database migration system for seamless future updates

== Upgrade Notice ==

= 1.0.0 =
Initial release. Install to start tracking all WordPress emails.

== Privacy Policy ==

Eprimo Mail Radar stores email data in your WordPress database. Depending on your privacy settings, this may include:

* Sender and recipient email addresses
* Email subject line
* Email content (can be disabled)
* Email headers
* Attachment filenames and sizes (can be disabled)
* Send date and delivery status
* Source plugin or theme name

**No data is transmitted to external servers.** All logged data remains on your WordPress installation.

Eprimo Mail Radar provides privacy controls to:

* Disable email content logging
* Mask recipient email addresses
* Disable attachment information logging

You are responsible for configuring these settings in compliance with your privacy policy and applicable data protection regulations.

= Minimum Requirements =

* WordPress 5.8 or higher
* PHP 7.4 or higher
* MySQL 5.6 or higher / MariaDB 10.1 or higher