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

Modular SMTP configuration, monitoring, and privacy-friendly mail logging (GDPR) for WordPress - with no external services.

== Description ==

Bentostudio Mail is a modular solution for securely sending and storing emails in WordPress. Mail management is built entirely on native WordPress APIs - no external dependencies, no SaaS account required.

With SMTP sending, you simply use your own email address - for example, one you already have with your hosting or email provider - as the sender address for all emails sent from WordPress. The actual sending happens through your provider's mailbox; the plugin only handles the setup in WordPress and verifies the connection.

The benefit: you are not dependent on paid third-party sending services, and you keep full control over your data, since it is exchanged exclusively between your WordPress site and your own provider.

The plugin deliberately focuses on the core functions of SMTP sending and mail logging. For SMTP configuration, it provides an SMTP interface without pulling in additional third-party service dependencies, along with extensive testing and overview features for the system configuration. With logging, you can review outgoing emails and store them in line with applicable data protection requirements.

The two core areas - SMTP settings and mail logging - can also be used independently of each other: for example, you can configure SMTP sending only, without logging any mails, or use the mail log without changing anything about the sending route.

Using a simple permission system, the plugin's functions can be assigned to specific groups via drag and drop. All three areas (mail sending, logging, and access control) can easily be assigned to existing user roles.

No separate Pro version. All features are free to use, and no subscription is required.

**Mail Sending**

* Simple configuration of the SMTP sending method directly in the WordPress backend.
* Monitoring of the current settings and a built-in test option.
* Technically thorough two-step connection diagnostics: a socket test and a PHPMailer handshake with a captured debug transcript.
* Send a live test email to confirm end-to-end delivery.
* Detects other active third-party SMTP plugins.

**Mail Log & Statistics**

* Stores sent emails (similar in principle to Flamingo).
* Privacy-friendly by design: data is stored exclusively in your own server's local database - no external services or cloud connections involved.
* Freely configurable retention by entry count and/or age, helping you apply the data minimization / storage limitation principle required by data protection laws such as GDPR (EU/UK), CCPA/CPRA (California), LGPD (Brazil), PIPA (South Korea), PDPA (Singapore), and DPDPA (India).
* Dashboard with live SMTP status, delivery statistics, and an activity overview.
* Logs failed delivery attempts.
* Identifies the sending source in the statistics (e.g. Contact Form 7, WordPress system notifications).

**Simple Access Control**

* Assign access to the statistics and SMTP settings with a single click.
* Uses WordPress's existing user roles (Editor, Shop Manager, etc.) - no separate permission system required.
* Four granular capabilities, one per module page.

**Other Technical Features**

* Clean uninstall: removes the database table and 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 server reachability via a socket probe and PHPMailer handshake.
5. Click **Send Test Email** to confirm end-to-end delivery.

== Frequently Asked Questions ==

= Is sending via SMTP secure and reliable? =

Yes. Compared to the default PHP mail() function, which many WordPress installations use without any further configuration, sending via SMTP is generally far more reliable: the email is sent directly and authenticated through your own mailbox at your email or hosting provider, instead of being sent unauthenticated through the web server. This noticeably reduces the risk of emails ending up in the spam folder or not being delivered at all. How secure the connection itself is depends on the chosen encryption method - TLS or SSL are recommended (see the next question).

= What do I need to send via SMTP? =

You need an existing email mailbox with your provider or hosting company, along with its SMTP credentials. You can usually find these in your account area or on your provider's help pages:

* SMTP server (hostname, e.g. smtp.your-provider.com)
* Port (commonly 587 for TLS or 465 for SSL)
* Encryption method (TLS, SSL, or none)
* Username (usually the full email address)
* Password (ideally an application-specific password, if your provider supports it)

You enter these details once in the plugin's SMTP settings, then verify the connection using the connection test and test email.

= 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.

= Does the plugin detect other active SMTP plugins? =

Yes. Bentostudio Mail detects when other SMTP plugins are active and flags this to the user. It does not automatically disable or modify those plugins' settings - however, due to hook load order, its own `phpmailer_init` configuration is the one that ends up controlling actual mail delivery.

= Does this plugin help with compliance with data protection laws like GDPR or CCPA? =

All mail logs are stored exclusively in your own server's local database - no data is transmitted to external services. The freely configurable retention period and entry limit help you apply the data minimization principle required by GDPR/DSGVO, CCPA/CPRA, LGPD, PIPA, PDPA, and DPDPA, among others. Ensuring your privacy policy and its legal basis are compliant remains your responsibility.

= Can I grant SMTP or statistics 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.

= 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 live SMTP status, delivery statistics, and a recent mails table.
2. Statistics page showing sent mails, success rate, and errors, plus the full mail log view.
3. SMTP settings page with connection test and debug view.
4. Plugin setup - role assignment for statistics and SMTP access.
5. Plugin setup - statistics settings (enable/disable, delete logs, retention count and period).

== Changelog ==

= 2.0.3 =
* Fix: Age-based log retention (Max. storage duration) now correctly deletes entries older than the configured number of days.
* New: The SMTP Settings page now displays the currently active WordPress mail sending method (SMTP, PHP mail, Sendmail, etc.) with full configuration details, detected live via `phpmailer_init`.
* Change: "Max. storage duration" now defaults to 14 days when left empty - same behaviour as "Max. number of entries" (default: 10,000). Saving 0 or an empty field applies the 14-day default.

= 2.0.2 =
* Improved formatting in the mail preview.

= 2.0.1 =
* Consolidated update - see previous releases.

= 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.
* Detection of active third-party SMTP plugins.
* Mail log with configurable entry-count and age-based retention limits.
* AJAX detail modal with sandboxed email body preview.
* Clean uninstall script.

== Upgrade Notice ==

= 2.0.3 =
Bug fix: age-based log retention now works correctly. Upgrade recommended if you use the "Max. storage duration" setting.

= 2.0.2 =
Minor improvement: refined formatting in the mail preview.

= 2.0.1 =
Consolidated update - no known breaking changes.
