=== Optcatch – Lead Capture, Email Campaigns & Newsletter for Any Form ===
Contributors: eliastoss, freemius
Tags: email marketing, newsletter, contact form 7, smtp, mailing list
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.9.28
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lead capture & newsletter plugin. Turn any form into an email list and send campaigns from your own Gmail, Outlook or SMTP.

== Description ==

Optcatch turns the forms you already have into an email list, then lets you send newsletters and campaigns from your own email accounts. No per-subscriber fees, no third-party CRM, no list buying.

**Why people use it**

* **Works with any form.** Contact Form 7, WPForms, Elementor, Gravity Forms, Fluent Forms, Ninja Forms, WooCommerce, page builders or plain HTML. If it has an email field, it's captured.
* **Consent record for every contact.** The consent basis, wording version and timestamp are stored, and every send is checked against that record.
* **Send from your own accounts.** Gmail, Microsoft 365, SendGrid or any SMTP server, with automatic rotation across accounts.
* **No limits in the free version.** Unlimited contacts, segments and templates.
* **Built for GDPR.** Explicit opt-in by default and one-click unsubscribe in every email.

**Who it's for**

Small businesses, bloggers, shops and agencies who want a mailing list on their own site without paying monthly subscriber fees.

= Lead capture =

* **Universal auto-detect** – on by default. Any form with an email field is captured: contact forms, newsletter boxes, popups, theme and page-builder forms (Divi, Bricks, Beaver Builder…) and custom HTML. Login, password, search and payment forms are ignored. No code needed.
* **Form plugin integrations** – Contact Form 7, WPForms, Elementor Pro Forms, Gravity Forms, Fluent Forms and Ninja Forms are also captured server-side, with their native consent/acceptance fields recognised and the form name recorded as the contact's source. WooCommerce customers can opt in at checkout or account registration.
* **Consent checkbox** – by default a consent checkbox is added to captured forms and unticked submissions are not stored. Your form already has a marketing opt-in? Add the class `lcc-consent` to it and it is reused instead. An optional "Automatic Consent on Submission" policy captures every submission and records that policy as the consent basis.
* **Shortcode form** – no form yet? `[optcatch_form]` drops a clean, mobile-friendly signup form anywhere.

= Email campaigns =

* **Campaign builder** – branded newsletters with header, buttons, social links and simple formatting.
* **Templates** – six starter designs (welcome, newsletter, product launch, follow-up, re-engagement, personal note) plus a drag-and-drop studio to save as many of your own as you like.
* **Segments** – filter by source (captured or imported), tag, name, email, phone, signup date or consent status. Contacts from Contact Form 7, WPForms, Elementor Pro Forms and Gravity Forms are tagged with their form plugin automatically.
* **CSV import and export** – bring existing subscribers in (up to 5,000 rows per file) with tags and a recorded permission statement.
* **Delivery dashboard** – live sent/failed/skipped counts per campaign and per sending account.
* **Allowlist sending** – every send intersects a positive-consent allowlist and excludes unsubscribed contacts. One-click unsubscribe link and List-Unsubscribe headers in every email.

= Sending accounts =

* **Multi-SMTP rotation** – connect as many sending accounts as you like; campaigns rotate across them so no single mailbox hits its provider limit.
* **Daily limits and pacing** – each account has its own daily limit and per-minute sending speed, so a campaign is spread out instead of going in one burst. A circuit breaker pauses an account automatically when its provider starts rejecting mail.
* **Gmail / Google Workspace and Microsoft 365 / Outlook via OAuth2** – no raw mailbox password stored. **SendGrid API** and **any SMTP server** are supported too.
* **Reliable background delivery** – a heartbeat, a token-protected tick URL for server cron, and a reconciler that unsticks any campaign.

= Free vs Pro =

The free version is complete on its own and has no usage limits: form auto-capture, CSV import, unlimited contacts, saved segments and custom templates, the starter templates, immediate sends, and any number of sending accounts with daily limits, sending speed and rotation.

Optcatch Pro adds features, not bigger numbers:

* **Email warm-up** – a new Gmail, Outlook or SMTP account starts at a safe daily volume and ramps up automatically. You set the start, growth and ceiling; the next day's higher limit only unlocks once a day has really used its allowance.
* **Scheduled sends and drip / autoresponder campaigns** – send later, or deliver a welcome message or sequence a set number of days after capture.
* **Wake-up and re-engagement** – a follow-up shortly after capture, and one win-back email for contacts who have gone quiet, recovering leads you already paid for.
* **Webhooks & REST API** – send leads from Zapier, Make, Typeform, landing-page builders or your own code to a secure endpoint protected by a secret key.
* **Pro template library** – six more ready-made designs: event / webinar invitation, flash sale with coupon code, lead-magnet delivery, customer story, appointment confirmation & reminder, and a review request with one-click rating buttons.
* **Attachments and hosted download links**.

Optcatch Pro is a separate plugin, available from [optcatch.com](https://optcatch.com/) and not hosted on WordPress.org. It is installed on its own and keeps your contacts, campaigns and settings. This free plugin contains no Pro code and no license checks: nothing in it is locked or waits for a key, and no license key can unlock anything inside it. The Pro features exist only in Optcatch Pro.

== External services ==

This plugin connects to the following third-party services. None of these connections
happen unless you actively opt in or configure the feature described.

* **Freemius** — used for the optional opt-in and for Pro licenses. Nothing is sent to
  Freemius unless you choose to: (1) if you click "Allow & Continue" on the plugin's opt-in
  screen, your name and email, the site URL, WordPress/PHP/plugin versions and this plugin's
  activation/deactivation events are sent (the list of other plugins and themes too, unless
  you switch it off on that screen); (2) if you use Optcatch Pro (a separate plugin), its license key
  and site URL are sent to validate it; (3) if you fill in the optional feedback form when
  deactivating, the reason you choose is sent anonymously. If you skip the opt-in, nothing is
  sent. The free version receives its updates from WordPress.org.
  [Freemius Terms of Service](https://freemius.com/terms/) |
  [Freemius Privacy Policy](https://freemius.com/privacy/)
* **SendGrid** — only if you choose SendGrid as your sending provider in Settings. Each
  campaign/wake-up email (recipient address, subject, body, and any attachment) is sent via
  SendGrid's Mail Send API instead of your server's own mail transport.
  [SendGrid Terms of Service](https://www.twilio.com/en-us/legal/tos) |
  [SendGrid Privacy Policy](https://www.twilio.com/en-us/legal/privacy)
* **Google (Gmail)** — only if you connect a Google account for sending. The plugin uses
  Google's OAuth2 flow to obtain and refresh a token used solely to authenticate outgoing
  mail via Gmail's SMTP/API; your Google account email address is read to confirm which
  account is connected.
  [Google Terms of Service](https://policies.google.com/terms) |
  [Google Privacy Policy](https://policies.google.com/privacy)
* **Microsoft 365 / Outlook** — only if you connect a Microsoft account for sending. The
  plugin uses Microsoft's OAuth2 flow and the Microsoft Graph API in the same way as the
  Google integration above, solely to authenticate and send outgoing mail.
  [Microsoft Services Agreement](https://www.microsoft.com/en-us/servicesagreement/) |
  [Microsoft Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement)

== Data this plugin collects, and when ==

Per WordPress.org Plugin Guideline 7, here is exactly what is stored and when.

**From your visitors (only when they tick the consent box on one of your forms):**

* Email address, and any of: phone, first name, last name, company — read from your form's
  own fields at the moment of submission.
* The URL of the page the form was on (`source_page`).
* Consent evidence: `consent_status = opted_in`, the exact consent wording shown, a wording
  version id, and a UTC timestamp.

If the visitor does **not** tick the box, **nothing is sent or stored** — the form submits
normally and the plugin ignores it. This is the default.

**Optional "Automatic Consent on Submission" policy:** if you switch to it under Settings, every
form submission is stored as above without a checkbox, and the consent evidence records that the
contact was captured under this policy (no checkbox wording is attached). You are responsible for
having a legal basis to email these contacts.

**From you, the site owner (only when you import):**

* The contact fields you provide (email, phone, names, company, tags).
* Consent evidence: `consent_status = customer_declared`, the permission statement you affirmed,
  and a UTC timestamp. The plugin also records that you checked the "I confirm I have permission
  to email these contacts" box, with a timestamp and your user id.

**Sending / operational data:**

* Per-recipient send records (which campaign, which contact, sent/failed/skipped, timestamp).
* Unsubscribe events (status set to `unsubscribed` with a UTC timestamp).

**The plugin does NOT** collect passwords, payment/card data, or other sensitive fields from
your forms — those field types are explicitly excluded from capture. By default, email is
delivered through your own site's `wp_mail()` and no lead/contact data leaves your site. If
you choose to configure SendGrid, Gmail, Microsoft 365 or an SMTP server as your sending
provider, the recipient address and email content are sent to that provider to deliver the
message — see "External services" above for details.

== Sample privacy-policy clause ==

You are responsible for your own privacy policy. You may adapt the following:

> **Marketing contact data.** When you submit a form on this site and tick the marketing
> consent box, we store the contact details you entered (such as your email address and name),
> the page you submitted from, and a record of the consent wording you agreed to together with
> the date and time. We use this to send you marketing emails you have consented to. You can
> withdraw consent at any time using the unsubscribe link in any email, after which we will not
> email you again. We do not sell this data or share it with third parties for their own
> marketing. To request access to, or deletion of, your data, contact us at [your address].

== Frequently Asked Questions ==

= Which forms does it work with? =
Any form on your site that has an email field: form plugins, theme and page-builder forms (Divi, Bricks, Elementor…), popups and custom HTML. Universal auto-detect is on by default, so there is nothing to set up; in strict mode the plugin adds its consent checkbox to the forms it detects. If a form already has its own marketing opt-in checkbox, add the class `lcc-consent` to that checkbox (or its field wrapper) and the plugin reuses it instead of adding a second one. If you'd rather choose forms yourself, turn auto-detect off: then only forms you have marked with that consent class, plus the form-plugin integrations you switch on, are captured.

= How do I build an email list from my existing contact form? =
Leave universal auto-capture switched on. Any form with an email field is captured once the visitor ticks the consent box, which the plugin adds for you. You don't need to edit your form.

= Can I send leads from Zapier, Make, Typeform or any other application into the list? (Pro) =
Yes, with Optcatch Pro (separate plugin from optcatch.com). Pro adds a webhook / REST API endpoint with a secret key. Any application or third-party service that collects leads and can send an HTTP request can push them here: Zapier, Make, Typeform, Calendly, landing-page builders, a CRM, a chatbot, a lead-generation vendor, a mobile app or your own code. Each lead is created with its consent basis recorded, deduplicated and tagged, exactly like a form submission. Settings → Advanced Integrations shows the endpoint (`/wp-json/optcatch/v1/lead`), the key (sent in the `X-Optcatch-Key` header or as `Authorization: Bearer`), a payload reference and ready-to-use Zapier and cURL examples. Forms on your own site never need this.

= Can it capture Contact Form 7 leads into an email list? =
Yes – like every other form on your site. Contact Form 7 is also integrated server-side: its native [acceptance] field is recognised as the opt-in, and the contact is created with its consent basis recorded. No webhooks, Zapier or external CRM needed. Switch to "Automatic Consent on Submission" if you want every submission captured.

= Does it work with WPForms, Elementor Pro, Gravity Forms and WooCommerce? =
Yes. These are captured like any other form, and also get built-in server-side integration: WPForms, Elementor Pro Forms, Gravity Forms, Fluent Forms, Ninja Forms and WooCommerce checkout/registration.

= What is SMTP warm-up (email warm-up), and does it warm up a new Gmail or SMTP account? (Pro) =
Sending hundreds of emails from a fresh account gets it flagged as spam. Warm-up starts each account at a safe daily volume and raises the limit day by day (you set start, growth and ceiling) until it reaches full capacity. It works for Gmail, Microsoft 365, SendGrid and plain SMTP accounts.

= How does multi-SMTP sender rotation work? =
Connect several sending accounts. Campaigns are distributed across them within each account's daily limit, so no single mailbox hits its provider limit.

= Is this a Mailchimp alternative for WordPress? =
Yes, if you want to run your mailing list on your own site. Optcatch stores your contacts in WordPress and sends from your own email accounts. There are no per-subscriber fees and no limits on contacts in the free version.

= How is this different from WP Mail SMTP or FluentSMTP? =
Those plugins route your site's transactional mail through one SMTP connection. Optcatch is an email-marketing tool: it builds the list from your forms, segments it, and sends campaigns through one or several sending accounts with rotation (automated warm-up is an Optcatch Pro feature). You can keep your SMTP plugin for transactional mail.

= Can I send newsletters through Gmail or Microsoft 365 / Outlook? =
Yes. Both connect with OAuth2, so no raw mailbox password is stored. SendGrid (API key) and generic SMTP are also supported.

= How do I send a newsletter from WordPress with Gmail? =
Go to Optcatch → Settings, click "Add sending account" and choose Google / Gmail. Connect it with OAuth2: create an OAuth client in Google Cloud Console, paste its Client ID and Client Secret, and click "Sign in with Google / Connect" (the User Guide walks you through each step). Then create a campaign, choose a segment, and send. Set a Daily Sending Limit so you stay within Gmail's sending caps.

= Is it GDPR compliant? =
It records a consent basis for every contact: the policy in force (inquiry or explicit checkbox), the wording version, a UTC timestamp and the source page, and sending always excludes unsubscribed contacts. In strict mode (the default) nothing is stored unless the visitor ticks the box. Whether your use is compliant depends on your legal basis and privacy policy; see 'Data this plugin collects' and the sample clause.

= Can I set up automated drip or autoresponder emails? =
Yes, in Optcatch Pro (separate plugin from optcatch.com). Automation campaigns deliver a welcome message or sequence a set number of days after capture. The free version sends campaigns when you press send.

= What is the wake-up / re-engagement feature? =
Wake-up is available in Optcatch Pro (separate plugin from optcatch.com) and has two emails: a follow-up shortly after capture, and a re-engagement message for contacts that have gone quiet for a window you choose. Both are paced within your account limits.

= Can a campaign accidentally email someone who unsubscribed? =
No. Every send query intersects a positive-consent allowlist and excludes unsubscribed contacts. Unsubscribe status survives re-imports.

= Does it work without buying Pro? =
Yes, and there are no usage limits in the free version: unlimited contacts, saved segments and custom templates, CSV import up to 5,000 rows per file, campaigns, and any number of sending accounts with daily limits, sending speed and rotation. Automated warm-up, scheduled/automation sends, wake-up and re-engagement emails, attachments, the Pro template library (six extra designs) and the webhook / REST API endpoint for external tools are available in Optcatch Pro, a separate plugin from [optcatch.com](https://optcatch.com/).

= Can I import my existing subscribers? =
Yes. Use the CSV import (up to 5,000 rows per file). You will need to confirm you have permission to email those contacts.

= Will it slow down my forms or site? =
Capture adds one lightweight server-side step per submission, and campaigns go out in paced background batches, so page speed is not affected.

= Does this plugin scrape or buy email lists? =
No, and it never will. Contacts come only from your own consenting visitors or lists you confirm you have permission to email.

== Screenshots ==

1. Dashboard – campaign activity chart, live sending feed, per-account sending status and recent campaigns.
2. Settings → General & Compliance – universal auto-capture for any form on your site (form plugins, page builders, theme and popup forms), consent policy and the consent wording recorded with every contact.
3. Settings → Sending account – daily limit and sending speed (Pro adds the automated warm-up schedule with today's allowance).
4. Campaigns – new campaign: audience segment with its consent-verified recipient count, email template, attachment and delivery timing (scheduled delivery and attachments are Pro).
5. Contacts – consent status, consent timestamp, source, emails sent and tags for every contact, with filters by segment, source and consent.
6. Segments – live filter by source, tag, signup date and consent status, with a matching-contacts count before you save.

== Installation ==

1. Upload the `optcatch-lead-capture-campaigns` folder to `/wp-content/plugins/`.
2. Activate the plugin through the "Plugins" screen in WordPress.
3. Go to "Optcatch" in the admin menu. Review the consent wording under Settings.
4. Forms are detected automatically: any form with an email field (Contact Form 7, WPForms,
   Elementor, page-builder, theme or custom HTML forms) is captured. If a form already has its
   own marketing opt-in checkbox, add the class `lcc-consent` to it (or to its field wrapper) and
   that checkbox becomes the consent gate. Import a list or start a campaign.

== Changelog ==
= 0.9.28 =
* Added: after your first campaign has gone out, administrators see a one-time note on an Optcatch
  screen with a link to leave a review on WordPress.org. It is shown once per administrator and can
  be dismissed; nothing is offered in return for a review.
* Fixed: the User Guide promised open and click tracking on the Dashboard and segments by individual
  form. It now describes what the plugin does: sent, failed and skipped counts, and segments by tag
  (Contact Form 7, WPForms, Elementor Pro Forms and Gravity Forms tag their contacts automatically).

= 0.9.27 =
* Changed: the admin menu is now called "Optcatch" (was "Lead Capture") and uses the Optcatch logo
  as its icon. Page titles and the User Guide now say "Optcatch → …" to match.
* Added: a "Website" link to optcatch.com on the Plugins screen; the Plugin URI now points there.

= 0.9.26 =
* Fixed: the unsubscribe link in the plain-text version of an email could open "This unsubscribe link
  is invalid". Links were written as "text (url)" and some email services and mail apps counted the
  closing bracket as part of the link. Links are now written as "text <url>", and the unsubscribe page
  ignores stray characters added to the end of the link, so links in emails already sent work too.
* Fixed: the Email Studio's "Card Corner Radius" setting was lost when the template was saved, and
  emails always used 6px corners. The chosen radius is now saved and used in the email.
* Fixed (Pro): a campaign email could go out before a wake-up email that was already due when two
  sending checks ran within a few seconds of each other (for example "Send now" right after the
  background check). Due wake-ups now always go first.

= 0.9.25 =
* Fixed: in the Email Studio, typing into a text block's box in the side panel was sometimes lost after
  clicking there from the email preview (and the other way round), so the change was not saved.
* Fixed: the Guide and the Sending settings labelled extra sending accounts and sender rotation as Pro.
  They are included in the free version.

= 0.9.24 =
* Fixed (Pro): when re-engagement emails were waiting, they took every free sending slot and
  campaigns could sit at "0 sent" for hours. Re-engagement emails and campaigns now take turns;
  wake-up follow-ups for new leads still go first.
* Changed (Pro): automation emails (sent a set number of days after sign-up) now wait their turn with
  campaigns, oldest first, instead of always going ahead of every campaign.
* Fixed: a campaign deferred because the daily limit was reached waited until midnight even after the
  limit was raised. Saving a sending account now lets deferred campaigns continue right away when
  there is room. The same now goes for Pro automation emails held back by the daily limit.
* Fixed: an email that could not be sent because of the contact (for example an invalid address) or a
  broken template counted toward the account's daily, hourly and per-minute sending limits although it
  never left the site. It no longer does.
* Improved: every email the plugin sends (campaigns, test emails and Pro wake-up / re-engagement emails)
  now also carries a plain-text version next to the designed HTML version, made from the final email
  with links written out and the unsubscribe link included. This helps deliverability and readers whose
  mail app shows plain text only. Other emails on your site are not changed.
= 0.9.23 =
* Fixed: in the Email Studio, clicking a heading or text block on the canvas and typing right
  away lost the typed text (the canvas redrew and dropped the cursor). The cursor now stays where
  you clicked.
* Fixed (Pro): a wake-up or re-engagement email for a just-captured contact could be sent ahead
  of older contacts that were still waiting for theirs while sending was paced. They now go out
  oldest first.
* Improved: the campaign list now shows how many recipients were skipped because they were no longer
  recipients when their turn came (unsubscribed, deleted or removed from the segment). A campaign
  whose contacts were all removed used to read "0 sent / 2 total" with no explanation.
= 0.9.22 =
* Fixed: after an older version of the plugin had run again on a site that was already updated
  (for example an old zip uploaded once more), the next update stopped with "could not migrate its
  data to the new internal names" and switched the plugin off. The plugin now keeps that older
  data as backup tables, leaves your current data untouched, shows a one-time notice and keeps
  running. "Delete all plugin data" on uninstall also removes those backups.
= 0.9.21 =
* Fixed: the Sending Speed (per minute) is now a per-account limit shared by every campaign,
  wake-up and background run. Two campaigns sending at the same time could each use the full
  speed, sending twice as many emails per minute as configured.
* Fixed: when sending is paced, campaigns are now served oldest first. A campaign waiting for
  its turn could be overtaken by newer ones again and again and wait for hours; a paced campaign
  now resumes exactly when the next slot frees instead of re-checking every 5 minutes.
* Changed: sending is now spread evenly across the day. An idle account still sends a small batch
  at once (up to its Sending Speed), then one email every few minutes (daily limit spread over 24
  hours) instead of the whole hourly allowance in the first minutes of each hour followed by a long
  pause. Follow-ups and small campaigns no longer wait up to an hour behind a large send; the daily
  and hourly limits are unchanged.
= 0.9.20 =
* Fixed: the background job schedule was never created on a fresh activation (the one-minute
  interval was not registered before scheduling). Activation now registers it first, and the hourly
  fallback re-creates a missing schedule on its own.
* Changed: every inline script and style is now an enqueued file, loaded only on the plugin's own
  screens.
* Changed: the free build contains no license checks and no Pro code. The Pro features (wake-up and
  re-engagement, scheduled and automated delivery, attachments, warm-up, the Pro templates,
  webhooks) exist only in Optcatch Pro, a separate plugin from optcatch.com.
* Fixed: unslashed input and a dead test-email handler flagged by Plugin Check; the REST tick token
  is now checked in the route's permission callback.
* Changed: internal names now use the "optcatch" prefix (WordPress.org requires prefixes of at least
  four characters). Settings, contacts, campaigns, tables and scheduled tasks move automatically on
  the first page load after the update; if they cannot be moved, the plugin stays inactive, shows the
  reason to administrators and retries on every page load.
* Breaking: the REST base path is now `/wp-json/optcatch/v1/` (or `/?rest_route=/optcatch/v1/...`):
  webhook endpoints `optcatch/v1/lead`, `optcatch/v1/webhook` and `optcatch/v1/capture`, heartbeat
  `optcatch/v1/tick`. Update the URL in Zapier, Make and other webhook senders and in any server
  crontab that calls the tick. The `lcc/v1` paths no longer exist. The `X-LCC-Key` and
  `X-LCC-Tick-Token` header names are still accepted next to `X-Optcatch-Key` / `X-Optcatch-Tick-Token`,
  and existing webhook keys stay valid.
* Breaking: the Gmail / Microsoft OAuth redirect URI is now
  `.../wp-admin/admin.php?page=optcatch-settings&action=optcatch_google_oauth_callback` (Google) and
  `...&action=optcatch_microsoft_oauth_callback` (Microsoft). Add the new redirect URI to your OAuth
  app in Google Cloud / Azure before you reconnect an account; already connected accounts keep working
  with their stored refresh tokens.
* Breaking: WP-CLI commands are now `wp optcatch run-jobs` and `wp optcatch wakeup`.
* Breaking: filters and actions use the `optcatch_` prefix, e.g. `optcatch_lead_form_selector`,
  `optcatch_consent_checkbox_selector`, `optcatch_capability` and `optcatch_upgrade_url`. Update
  custom code that hooks the old `lcc_` names.
* Breaking: the shortcode is now `[optcatch_form]`; the older `[lead_capture_form]` and three-letter
  shortcode names were removed. Replace them on pages that embed the form.
* Unsubscribe links in emails sent before this update keep working.
* Admin pages moved to `admin.php?page=optcatch-...`; old `page=lcc-...` bookmarks redirect.
* Purge your page caches after updating: cached pages still carry the old form field names and
  script data.

= 0.9.19 =
* Fixed: contacts captured from forms on your own site were tagged "webhook" even though they did
  not come from a webhook. They are now tagged "auto-capture"; only leads that arrive through the
  Pro webhook key (with no tags of their own) get the "webhook" tag. Existing contacts keep their
  tags; remove the old "webhook" tag from them in Contacts if you like.

Earlier versions: see changelog.txt in the plugin folder.

== Upgrade Notice ==

= 0.9.20 =
Internal names move to the optcatch prefix automatically. Webhook/REST URLs (optcatch/v1), OAuth redirect URIs, WP-CLI commands, hook names and the shortcode changed: see the 0.9.20 changelog. Purge page caches after updating.
