=== Dropndot Email Subscriptions and Newsletters ===
Contributors: dropndot
Tags: newsletter, subscription, email, mailing-list, graphql
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Email subscriptions and newsletters with GraphQL support, email confirmations, and an admin interface.

== Description ==

Dropndot Email Subscriptions and Newsletters is a full-featured email subscription and newsletter plugin for WordPress. Collect subscribers with double or single opt-in, manage them from a dedicated admin dashboard, send newsletters, and integrate with headless frontends via REST API or GraphQL.

= Core Features =

* Double opt-in and single opt-in subscription modes
* Branded confirmation, welcome, and unsubscribe emails with shared logo, banner, and footer
* Customizable headlines, icon badges, feature grid, disclaimer, and social footer links
* In-browser email preview before saving or sending
* One-click unsubscribe with optional confirmation emails
* One-click re-subscribe from unsubscribe emails (token-based)
* Admin dashboard with statistics, search, filters, and bulk actions
* CSV export with geolocation data (country, region, city, timezone)
* Subscription form shortcode with customizable appearance

= Advanced Features =

* Google reCAPTCHA v2 and v3 spam protection (optional)
* IP-based rate limiting
* Automatic geolocation via ipinfo.io (country, region, city, and timezone)
* Custom confirmation and unsubscribe pages
* Admin email notifications for new subscriptions and unsubscribes
* REST API for full CRUD operations
* GraphQL support (requires the [WPGraphQL](https://wordpress.org/plugins/wp-graphql/) plugin)
* Headless frontend integration for Next.js and React applications
* Trusted frontend proxy secret for accurate visitor geolocation behind server-side proxies
* AJAX-powered admin interface

= Email Newsletter Features =

* Email template management with TinyMCE editor
* Send newsletters immediately or schedule for future delivery
* Country-based subscriber filtering
* Subscriber placeholders including `{city}` and `{timezone}`
* Batch processing for large subscriber lists (10,000+)
* Real-time progress tracking during sends
* Complete sending history with statistics
* HTML emails optimized for major email clients

= Shortcodes =

* `[dropemsu_form]` — Display a subscription form (optional `title` and `button_text` attributes).
* `[dropemsu_confirmation_status]` — Show confirmation status on a custom confirmation page.
* `[dropemsu_unsubscribe_status]` — Show unsubscribe status on a custom unsubscribe page.

= REST API =

All routes are registered under the `dropemsu-manager/v1` namespace and include endpoints for listing, creating, updating, deleting, confirming, and unsubscribing.

== Installation ==

1. Upload the `dropemsu-manager` folder to the `/wp-content/plugins/` directory, or install through the **Plugins > Add New** screen in WordPress.
2. Activate the plugin through the **Plugins** menu.
3. Go to **Subscriptions > Settings** to configure subscription, email, security, and API options.
4. Add the `[dropemsu_form]` shortcode to any page or post to display a subscription form.

Upon activation, the plugin creates the required database tables and sets default options automatically.

== Frequently Asked Questions ==

= How do I enable double opt-in? =

Go to **Subscriptions > Settings > Subscription** and enable **Require Email Confirmation**.

= Can I use this with a Next.js or React frontend? =

Yes. Enable **Frontend Integration** under **Subscriptions > Settings > API & Info** and use the REST API endpoints from your headless application.

= Does this work with WPGraphQL? =

Yes, when the [WPGraphQL](https://wordpress.org/plugins/wp-graphql/) plugin is installed. Enable GraphQL under **Subscriptions > Settings > API & Info**.

= How do I customize email templates? =

For confirmation, welcome, and unsubscribe emails, go to **Subscriptions > Settings > Emails**. Use **General & Branding** for the shared logo, banner, feature grid, disclaimer, sign-off, and social links. Each email has its own tab for headline, icon badge, subject, and body. Use **Preview Email in New Tab** to check the result before saving. For newsletters, go to **Subscriptions > Email Newsletter > Templates**.

= Can I export subscriptions? =

Yes. Use the **Export to CSV** button on the Subscriptions admin page. Exports include geolocation data (country, region, city, and timezone).

= Is reCAPTCHA required? =

No. reCAPTCHA is optional and can be enabled under **Subscriptions > Settings > Security**.

= Does the plugin work with SMTP plugins? =

Yes. The plugin uses WordPress's standard `wp_mail()` function and works with any SMTP or mail delivery plugin.

= How do I send newsletters? =

Go to **Subscriptions > Email Newsletter**, create or select a template, choose your audience (all subscribers or by country), and send immediately or schedule for later.

== Screenshots ==

1. **Email Subscriptions Dashboard** – View all subscribers at a glance with total, active, pending, and inactive counts. Search, filter by status, and manage individual subscriptions from one place. City and timezone are shown alongside country and region.
2. **Email Newsletter** – Compose and send newsletters to all active subscribers. Use an optional saved template, write a subject and body in the visual editor, and send immediately or schedule for later.
3. **Settings Page: Form Design & Live Preview** – Customize the subscription form's title, button text, colors, and layout. A live preview updates in real time so you can see exactly how it will look before saving.
4. **Settings Page: Email Branding** – Upload a logo and banner, set accent colors, and customize the confirmation, welcome, and unsubscribe emails. Preview any template in a new tab before saving.

== External services ==

This plugin may connect to third-party services when the related features are enabled:

**ipinfo.io** (Geolocation)

* Used to detect subscriber country, region, city, and timezone from IP address during subscription.
* Data sent: visitor IP address.
* [Terms of Service](https://ipinfo.io/terms-of-service)
* [Privacy Policy](https://ipinfo.io/privacy-policy)

**Google reCAPTCHA** (Spam protection, optional)

* Used when reCAPTCHA is enabled in plugin settings.
* Data sent: information required by Google reCAPTCHA to verify submissions.
* [Terms of Service](https://policies.google.com/terms)
* [Privacy Policy](https://policies.google.com/privacy)

== Changelog ==

= 1.0.4 =
* Added branded HTML templates for confirmation, welcome, and unsubscribe emails, with shared logo, banner, accent color, sign-off, and social footer links.
* Added customizable headlines, icon badges, feature grid, disclaimer box, and link-validity notice.
* Added in-browser email preview from **Settings > Emails**.
* Added city and timezone to geolocation, the admin subscriber table, CSV export, newsletter placeholders, REST, and GraphQL.
* Improved the Emails settings layout with branding, template, and notification sub-tabs.

= 1.0.3 =
* Added one-click re-subscribe from unsubscribe emails, including REST endpoint and frontend path support.
* Added optional trusted frontend proxy secret so proxied Next.js/React requests can forward the real visitor IP for geolocation.
* Improved subscription handling consistency across AJAX, REST, and GraphQL entry points.

= 1.0.2 =
* WordPress.org compliance: prefixed all hooks, options, and shortcodes; hardened input sanitization.

= 1.0.1 =
* WordPress.org compliance: prefixed AJAX hooks, enqueued assets, secured GraphQL endpoint.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.4 =
Adds branded confirmation, welcome, and unsubscribe emails with live preview, plus city and timezone in subscriber geolocation.

= 1.0.3 =
Adds one-click re-subscribe and optional trusted-proxy geolocation support for headless frontends.

= 1.0.2 =
WordPress.org review compliance update. Settings migrate automatically from legacy option keys. Shortcode aliases remain supported.

= 1.0.1 =
WordPress.org review compliance update. All stored option keys, database tables, and shortcodes are unchanged.

= 1.0.0 =
Initial release of Dropndot Email Subscriptions and Newsletters.
