=== Bentostudio Mail ===
Contributors: gunther9966
Tags: smtp, email, mail-log, statistics, mail-management
Requires at least: 6.2
Tested up to: 7.0
Stable tag: 1.0.18
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Modular WordPress mail management: SMTP configuration, connection diagnostics, mail logging, and delivery statistics.

== Description ==

Bentostudio Mail is a modular WordPress mail management plugin built entirely on native WordPress APIs — no external dependencies, no SaaS accounts required.

**Modules included:**

* **Overview** — Dashboard with live SMTP status, delivery statistics, and a recent activity table.
* **Statistics** — Paginated mail log with per-entry detail modal (headers + sandboxed body preview).
* **SMTP Settings** — Configure host, port, encryption, credentials, and From address. Run a two-step connection test (socket probe + PHPMailer handshake with full debug transcript) or send a live test email.
* **Plugin Setup** — Assign WordPress roles to each module capability and configure log retention limits.

**Key features:**

* Full SMTP routing via the `phpmailer_init` hook — works with any host that supports SMTP relay.
* Two-step SMTP diagnostics: raw `fsockopen()` socket probe followed by a full PHPMailer handshake with captured debug output.
* Mail log stored in a dedicated custom database table. Automatic pruning by entry count (default cap: 10,000) and/or age in days.
* Role-based access control: four granular custom capabilities, one per admin page, injected at runtime without touching the database.
* Modular architecture: new modules self-register via a single `config.php` — no changes to core files needed.
* Clean uninstall: drops the database table and removes every `wp_options` entry the plugin ever wrote.

== Installation ==

1. Upload the `bentostudio-mail` folder to `/wp-content/plugins/`.
2. Activate the plugin through **Plugins → Installed Plugins**.
3. Navigate to **Bentostudio Mail → SMTP Settings** and enter your SMTP credentials.
4. Click **Test Connection** to verify the server is reachable.
5. Click **Send Test Email** to confirm end-to-end delivery.

== Frequently Asked Questions ==

= Does this plugin store SMTP passwords securely? =

SMTP credentials are stored in `wp_options` in plain text, the same way all core WordPress options are stored. Restrict database access and use application-specific passwords where your provider supports them.

= Which encryption modes are supported? =

TLS (STARTTLS on port 587), SSL (implicit TLS on port 465), and none (unencrypted, not recommended).

= Can I grant SMTP access to editors or shop managers? =

Yes. In **Plugin Setup → Role Assignment** you can assign any registered WordPress role to each of the four access capabilities independently.

= How do I add a custom module? =

Create a directory under `modules/`, add a `config.php` that calls `BentostudioMail_Module_Loader::register_module()`, and optionally a `functions.php` for hooks and a `view.php` for HTML output. The loader discovers new modules automatically.

= What happens to my data when I uninstall the plugin? =

Clicking **Delete** in the plugin list runs `uninstall.php`, which drops the `{prefix}bentostudiomail_mail_log` table and removes all plugin options from `wp_options`. No data is left behind.

== Screenshots ==

1. Overview dashboard with SMTP status card, statistics card, and recent activity table.
2. Statistics page showing the paginated mail log with status indicators.
3. SMTP Settings page with connection test and live test email form.
4. Plugin Setup page — Role Assignment tab.
5. Mail detail modal with headers and sandboxed body preview.

== Changelog ==

= 1.0.18 =
* Initial public release.
* Modular architecture with four built-in modules: Overview, Statistics, SMTP Settings, Plugin Setup.
* Role-based capability system with per-module granularity.
* SMTP connection tester with raw socket probe and full PHPMailer debug transcript.
* Mail log with configurable entry-count and age-based retention limits.
* AJAX detail modal with sandboxed email body preview.
* Clean uninstall script.

== Upgrade Notice ==

= 1.0.18 =
Initial release — no upgrade steps required.
