=== TVS Block Newsletter ===
Contributors: SarimAshrafi
Donate link: https://thevertechs.com
Tags: newsletter, email marketing, smtp, block editor, subscribers
Requires at least: 5.8
Tested up to: 7.1
Stable tag: 1.2.0
Requires PHP: 7.4

License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send beautiful block-designed newsletters directly from your WordPress dashboard using default SMTP.

== Description ==

**TVS Block Newsletter** is a lightweight, native WordPress newsletter and email marketing plugin. Design newsletters visually using the native Block Editor and send campaigns directly from your WordPress dashboard using your site's default SMTP setup.

= Key Features =

* **Multi-Template In-Post Forms**: Choose from 5 beautiful pre-designed templates including Editorial Warm (In-Article Banner), Modern Minimal, TVS Brand Classic, Midnight Dark, and Compact Strip.
* **100% Full-Width & Fully Responsive**: Stretches edge-to-edge across any article or container, and automatically stacks into mobile-friendly touch targets on smartphones and tablets.
* **Visual Form Customizer**: Customize card backgrounds, serif/sans-serif typography, button colors, borders, and rounded corners in both Gutenberg and plugin settings.
* **Automatic In-Post Placement**: Automatically inject your styled newsletter signup form into blog posts (after 2nd/3rd/5th paragraph or bottom of post).
* **Native Block Editor**: Design email campaigns visually using standard paragraph, heading, list, button, and image blocks.
* **Quick-Send from Post Editor**: Send published blog posts directly as email newsletters to subscribers with one click from the post editor sidebar.
* **Database-Backed Queue**: Prevents PHP execution timeouts and SMTP rate limits by sending emails in customizable background batches via WP-Cron.
* **Comprehensive Subscriber Management**: View, search, filter, inline-add, import (CSV), and export (CSV) subscriber lists effortlessly.
* **Frontend Signup Block & Shortcode**: Place newsletter signup forms anywhere using the custom Block Editor block or shortcodes with custom parameters.
* **Inline Email-Safe Styling**: Automatically converts block editor layouts into HTML tables and inline styles for 99%+ inbox rendering across Gmail, Apple Mail, and Outlook.
* **1-Click Unsubscribe**: Personalized unsubscribe merge link automatically included in every email footer.
* **Zero Third-Party Lock-in**: Uses your site's default `wp_mail()` and SMTP setup.

== Shortcode Guide & Form Embedding ==

You can embed newsletter subscription forms anywhere on your site using Block Editor Blocks or Shortcodes.

= Basic Shortcode =
Paste `[tvs_block_newsletter_signup]` in any Page, Post, Sidebar, Footer Widget, or Popup plugin.

= Template Parameter =
Choose between templates directly in the shortcode:
* `[tvs_block_newsletter_signup template="editorial"]` (Warm sand card with serif heading & rust button)
* `[tvs_block_newsletter_signup template="minimal"]` (Clean white card with slate button)
* `[tvs_block_newsletter_signup template="brand"]` (Signature TVS brand styling)
* `[tvs_block_newsletter_signup template="dark"]` (Midnight dark theme with glowing button)
* `[tvs_block_newsletter_signup template="compact"]` (Streamlined pill banner)

= Customized Shortcode Parameters =
Customize heading titles, descriptions, button labels, and styles directly in the shortcode:

* `template`: Selects template (`"editorial"`, `"minimal"`, `"brand"`, `"dark"`, `"compact"`).
* `title`: Sets the heading text (default: `"Subscribe to Our Newsletter"`).
* `description`: Sets the subtext (default: `"Get the latest updates directly in your inbox."`).
* `button_text`: Sets the button label (default: `"SUBSCRIBE NOW"`).
* `full_width`: Set to `"true"` or `"false"` (default: `"true"`).
* `form_layout`: Set to `"inline"` or `"stacked"`.
* `heading_font`: Set to `"serif"` or `"sans-serif"`.
* `bg_color`: Custom card background hex color.
* `button_bg`: Custom button background color.
* `border_radius`: Custom card border radius in pixels.

Examples:

`[tvs_block_newsletter_signup template="editorial" button_text="JOIN OUR VIP CLUB"]`

`[tvs_block_newsletter_signup template="minimal" title="Weekly Tech Digest" button_text="Sign Up Free"]`

== How to Use ==

= 1. Designing & Sending a Newsletter =
1. Go to **TVS Block Newsletter → Create Newsletter**.
2. Type your email subject in the Title box.
3. Design your email body using standard blocks.
4. In the right sidebar box (**Send Campaign Settings**), click **🚀 Queue & Send Newsletter**.

= 2. Quick-Sending a Blog Post =
1. Edit any published blog post in WordPress.
2. Look at the right **Document Sidebar** panel for **📧 TVS Newsletter Quick-Send**.
3. Click **🚀 Quick Send as Newsletter**.

= 3. Importing & Exporting Subscribers =
1. Go to **TVS Block Newsletter → Import & Export**.
2. Upload a CSV file to import email lists, or click **Export CSV File** to download a backup.

== Installation ==

1. Upload the `tvs-block-newsletter` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **TVS Block Newsletter** in your admin sidebar to view your dashboard, manage subscribers, and send campaigns.

== Frequently Asked Questions ==

= Do I need an external service like Mailchimp or SendGrid? =
No! TVS Block Newsletter uses your website's built-in `wp_mail()` function. If you have SMTP configured on your WordPress site, emails will be delivered directly through your SMTP provider.

= How does the queue system work? =
Emails are queued in custom database tables (`wp_tvs_block_newsletter_queue`) and processed in small background batches via WP-Cron (default 20 emails/minute) to keep your server fast and avoid execution timeouts.

= How do subscribers unsubscribe? =
Every email sent includes an automatic 1-click unsubscribe link in the footer. Clicking it updates the user's status to `unsubscribed` instantly.

== Screenshots ==

1. Dashboard metrics overview and recent campaigns tracking.
2. Subscriber management table with search, status filters, and manual add form.
3. Native block newsletter editor.
4. Post editor sidebar quick-send button.
5. Frontend newsletter signup form block.

== Changelog ==

= 1.2.0 =
* Fix: Atomically claim queued emails to prevent duplicate delivery by overlapping workers.
* Fix: Skip unsubscribed or deleted recipients before delivery and wait for processing rows before completing campaigns.
* Fix: Normalize shortcode aliases and boolean values so documented customization options work.
* Fix: Preserve dynamic blocks when compiling newsletters to email HTML.
* Fix: Preserve surrounding markup when inserting forms after paragraphs.
* Fix: Honor a zero border radius and support PHP installations without mbstring.
* Feature: Added 5 responsive in-post form templates: Editorial Warm (In-Article Banner), Modern Minimal, TVS Brand Classic, Midnight Dark, and Compact Strip.
* Feature: Full-width container rendering (`100%`) edge-to-edge support with automatic mobile column stacking and responsive touch targets.
* Feature: Visual In-Post Form & Template Customizer in plugin settings with real-time live preview.
* Feature: Automatic in-post placement options: inject styled newsletter forms automatically into single posts after 2nd, 3rd, or 5th paragraph or at post bottom.
* Feature: Post Editor document sidebar setting to exclude individual posts from automatic in-post newsletter injection.
* Enhancement: Gutenberg Block Editor controls for template selection, typography (Serif/Sans), color palettes, full width, and live WYSIWYG canvas rendering.
* Enhancement: Preserved custom button labels across AJAX form submission lifecycle.

= 1.1.0 =
* Feature: Added TVS Block Newsletter Overview widget to the WordPress Dashboard Home screen (`wp-admin/index.php`).
* Enhancement: Complete TVS Brand design system overhaul matching Pro styling (Hero banners, KPI cards, badges, and button styling).
* Enhancement: Redesigned HTML email wrapper and unsubscribe landing page.
* Enhancement: Improved inline responsive image constraints for 100% email client compatibility across Gmail, Apple Mail, and Outlook.
* Enhancement: Added footer branding link to https://thevertechs.io/.

= 1.0.0 =
* Initial release.


