=== NMR Email Log for CF7 ===
Contributors: mirceatm
Donate link: https://paypal.me/mirceatm
Tags: contact form 7, cf7, email log, smtp, mail delivery
Requires at least: 5.8
Requires PHP: 8.0
Tested up to: 7.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Delivery log, failure diagnosis, and Resend routing for Contact Form 7. Know when CF7 emails fail — and fix them.

== Description ==

Contact Form 7 sends emails silently. When delivery fails, you get no feedback — just a lost lead. NMR Email Log for CF7 records every email attempt, explains failures in plain language, and lets you switch to reliable transactional delivery in one click.

**Delivery log:**

Every CF7 form submission is logged — sent, failed, or pending. The log shows the form name, recipient, subject, mailer used, and timestamp. Filter by status or form to find problems fast.

**Failure diagnosis:**

When an email fails, the plugin captures the raw PHPMailer error and translates it to a plain-English explanation with a specific fix suggestion — not just "mail send failed."

Common diagnoses:

* Host or port unreachable → your server blocks outbound SMTP → switch to Resend
* SMTP authentication failed → wrong username/password
* Invalid recipient address → a CF7 tag is resolving to a malformed email
* PHP mail() disabled → common on shared hosting → switch to Resend
* From address rejected → sender domain not authorized to send

**Resend routing (free):**

Switch from unreliable server mail to [Resend](https://resend.com) transactional delivery. Paste your API key, click "Send test email", done. Resend's free tier covers 3,000 emails/month — no credit card needed. All your CF7 forms use the same Resend account.

**Manual retry:**

Failed delivery? Hit Retry directly from the log. The plugin resends using the original rendered email body captured at send-time.

**Failure alerts:**

Get an email alert the moment a CF7 form fails to deliver. See the alert count for the current month in the log dashboard.

**Config scanner:**

Scans all CF7 forms for common mail configuration problems: missing recipient, empty body, empty subject, From address domain mismatch (a common cause of spam filtering). Issues link directly to the form editor to fix.

= Pro Version =

**[NMR Email Log for CF7 Pro](https://namir.ro/downloads/nmr-email-log-for-cf7-pro/)** adds:

* Multiple transactional providers: Mailgun, Brevo, Postmark, Resend
* Per-form provider routing — different provider per form
* Fallback provider if primary fails
* Failure alerts — webhook/Slack integration
* Auto-retry — automatic re-attempt 15 minutes after failure
* Per-form delivery rate statistics
* Flamingo retry integration — retry directly from Flamingo inbound messages
* Spam score pre-check before sending

= Privacy Notices =

With the default configuration, this plugin:

* Does not track users
* Stores email log data (form ID, recipient, subject, status, error) in a custom database table on your own server
* Does not send any data to external servers (unless Resend routing is enabled, in which case email is routed via resend.com per their privacy policy)
* Does not use cookies

== Installation ==

1. Upload the `nmr-email-log-for-cf7` folder to `/wp-content/plugins/`.
2. Activate through the **Plugins** menu.
3. Go to **Contact → Email Log** to view the delivery log.
4. Go to **Contact → Email Log Settings** to configure the mailer and alerts.

== Frequently Asked Questions ==

= Does this work without Resend? =

Yes. The log, failure diagnosis, config scanner, retry, and alerts all work with default WordPress mail. Resend routing is optional but recommended on shared hosting.

= Does Resend cost money? =

Resend has a free tier: 3,000 emails/month, no credit card required. Sign up at resend.com and paste your API key into the plugin settings.

= Why do my CF7 emails land in spam? =

The most common causes are: sending From an address on a different domain than your site, using PHP mail() on shared hosting with no SPF/DKIM, or sending From a Gmail/Yahoo address you don't control. The config scanner flags the From domain mismatch. Switching to Resend resolves the server reputation issue.

= Is the Resend API key stored securely? =

Yes. The key is encrypted with AES-256-CBC using a key derived from your WordPress secret keys before being stored in the database. It is never exposed in the admin HTML.

= Can I retry a failed email with the original message body? =

Yes. The plugin captures the rendered email body at send-time (after CF7 substitutes all field tags) and stores it in the log. The Retry button resends the original content, not a re-rendered template.

= Does it work alongside WP Mail SMTP or other mailer plugins? =

Yes for logging and diagnosis. If you have WP Mail SMTP active, its SMTP configuration takes effect — the log records what actually happened. If you enable Resend routing in this plugin at the same time as WP Mail SMTP, they may conflict; use one mailer plugin at a time.

== Screenshots ==

1. Mail log — paginated table showing all CF7 delivery attempts with status, form, recipient, mailer, and retry button for failed rows.
2. Settings — mailer selection (WordPress mail vs Resend), API key field, test send button, alert email.
3. Config scanner — flags missing recipient, empty body, and From domain mismatch across all forms with direct links to the form editor.
4. Pro features tab — full feature comparison table.

== Changelog ==

= 1.0.0 =
* Delivery log for all CF7 form submissions (sent, failed, pending, retried).
* Failure diagnosis — plain-English error explanations with fix suggestions.
* Resend SMTP routing — one API key, reliable transactional delivery for all forms.
* Manual retry from the log.
* Failure email alerts.
* CF7 config scanner — flags missing recipient, empty body, From domain mismatch.
* AES-256-CBC encryption for stored API key.
* Monthly usage counters.
