=== PressPilot Email Template Customizer ===
Contributors: cardeetech, neriomolina
Tags: email, template, wp_mail, smtp, branding
Requires at least: 6.2
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Wrap outgoing WordPress emails in a branded HTML template while keeping native `wp_mail()` delivery and SMTP compatibility.

== Description ==

PressPilot Email Template Customizer adds a presentation layer to outgoing WordPress emails. It does not replace `wp_mail()` and does not interfere with SMTP plugins.

Developed and maintained by **CardeeTech** (Cardee Technologies, SL).

Key features:

* Wrap outgoing `wp_mail()` messages with a consistent HTML template.
* Default Designer mode with visual tokens (logo, header image, colors, typography, width, radius).
* Custom HTML mode with placeholder replacement.
* Live preview in admin for faster iteration.
* Built-in test email tool (single or multiple recipients).
* WebP safety flow for email compatibility with PNG conversion cache.
* Diagnostics panel for runtime checks and recent log visibility.

Template modes:

* **Default Designer**: uses internal template + design tokens from settings.
* **Custom HTML**: uses your HTML as-is and replaces supported placeholders.

Supported placeholders:

`{{message}}`, `{{subject}}`, `{{site_name}}`, `{{site_url}}`, `{{site_host}}`, `{{logo}}`, `{{header_image}}`, `{{date}}`, `{{year}}`, `{{preheader}}`

Legacy compatibility during migration window:

* `{{ctetc_header_image}}` is still accepted for upgraded installations.

== Installation ==

1. Upload `presspilot-email-template-customizer` to `/wp-content/plugins/`.
2. Activate the plugin from **Plugins**.
3. Open **PressPilot** in the WordPress admin menu.
4. Configure wrapper mode, style tokens, and template settings.
5. Send a test email before production use.

== Frequently Asked Questions ==

= Does this replace WordPress email delivery? =
No. The plugin only transforms the message HTML before send. Delivery remains `wp_mail()` + your existing mail transport.

= Is it compatible with SMTP plugins? =
Yes. SMTP plugins continue to handle transport/authentication exactly as before.

= What happens if my custom template misses `{{message}}`? =
The message body is appended as a fail-safe to avoid blank emails.

= Can I use WebP images? =
WebP is detected and converted to PNG when possible for better email client compatibility. Converted files are cached under `wp-content/uploads/ppetc-cache/`.

= Is this plugin translation-ready? =
Yes. English is the source language, and Spanish is provided for all `es*` WordPress locales.

== Screenshots ==

1. Panel tab — status dashboard with ACTIVE/INACTIVE badge, system info, and quick setup checklist.
2. Settings tab — master enable switch, template mode selection (Default Designer or Custom HTML), and sender configuration.
3. Style tab — color token controls with live preview showing the branded email template in real time.
4. Reference tab — full placeholder reference table for Custom HTML mode.
5. Quick Guide tab — step-by-step setup guide for first-time configuration.
6. Custom HTML editor — HTML template editor with supported placeholders displayed as one-click chips.
7. Test email form and diagnostics panel — send real test emails and review system status checks.
8. Content blocks and footer configuration — pre/post content areas and footer visibility controls with live preview.

== Changelog ==

= 1.0.6 =
* Fix: WebP conversion now falls back to native PHP GD functions (imagecreatefromwebp/imagepng) when WordPress image editor abstraction fails. Handles servers where GD supports WebP but WordPresss WP_Image_Editor_GD rejects the file.


= 1.0.5 =
* Fix: WebP logo conversion now handles optimizer-generated WebP files (Imagify, EWWW, ShortPixel, Avada). When the registered attachment is the original PNG/JPG, its URL is returned directly instead of attempting GD/Imagick conversion.
* Fix: Conversion failure now shows a specific diagnostic message explaining why (CDN/URL mismatch, file not found, or missing GD/Imagick WebP support).
* Fix: Diagnostic hint added to "Convert for email" button to guide resolution without needing server log access.

= 1.0.4 =
* Fix: WebP logo conversion now works when the logo URL was entered manually (logo_id not set). Adds fallback via attachment_url_to_postid().
* Fix: Refresh preview button icon now aligns correctly with button text.

= 1.0.3 =
* Fix: Corrected Contributors field to match the WordPress.org owner account (cardeetech) and added co-author (neriomolina).
* Fix: Plugin URI updated to plugin-specific page.

= 1.0.2 =
* Fix: Email wrapper status badge and KPI icon now correctly show inactive (red/gray) state when wrapper is disabled.
* Fix: Color picker dropdowns no longer clip in the Style tab.
* Fix: Settings save now returns to the same tab instead of always returning to Panel.
* Fix: Preheader text is now visible in the admin preview as a labeled strip.
* Fix: WebP-to-PNG conversion for header images now falls back to attachment ID path resolution.

= 1.0.1 =
* Removed the admin bar shortcut.
* Updated the default test email message.

= 1.0.0 =
* First public release on WordPress.org.
* Canonical branding and architecture under `ppetc` / `PPETC_`.
* Wrapper engine for default and custom template modes.
* Placeholder system, live preview, diagnostics, and test-email workflow.
* WebP conversion cache and uninstall cleanup for canonical and legacy keys.
* Security/compliance hardening for WordPress.org publication.

== Upgrade Notice ==

= 1.0.6 =
Bug-fix: adds native GD fallback for WebP conversion on servers where wp_get_image_editor() fails but imagecreatefromwebp() is available.


= 1.0.5 =
Bug-fix release: corrects WebP logo conversion for optimizer-generated WebP files and adds diagnostic hints when conversion fails.

= 1.0.4 =
Bug-fix release: corrects WebP logo conversion when logo_id is 0 and fixes the refresh preview button icon alignment.

= 1.0.3 =
Metadata correction: fixes contributor usernames and plugin URI for WordPress.org compliance.

= 1.0.2 =
Bug-fix release: corrects the inactive status badge color, color picker clipping, tab redirect on save, preheader preview visibility, and header image WebP conversion.

= 1.0.1 =
Removes the admin bar shortcut and updates the default test email message.

= 1.0.0 =
Initial public release of PressPilot Email Template Customizer.
