=== MailCannon ===
Contributors: chmoez
Tags: email marketing, email campaigns, newsletter, bulk email, woocommerce, customers, marketing automation
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send MailCannon email marketing campaigns to WordPress users or WooCommerce customers directly from wp-admin.

== Description ==

MailCannon - Email Marketing and Campaign Sender connects your WordPress site to the MailCannon SaaS platform ([https://mailcannon.pro](https://mailcannon.pro)) so you can send MailCannon campaigns to your WordPress users and WooCommerce customers from the WordPress admin.

This plugin does NOT manage contacts in WordPress.

You manage contacts in the MailCannon dashboard:
[https://mailcannon.pro/dashboard/contacts](https://mailcannon.pro/dashboard/contacts)

When you send a campaign from WordPress, MailCannon will automatically create the contact in your MailCannon account if it does not already exist.

Support email: devchmoez@gmail.com

= Key Features =

* Connect WordPress to MailCannon via API key
* Fetch campaigns from your MailCannon account
* Select WordPress users as recipients
* Select WooCommerce customers as recipients when WooCommerce is installed
* Send bulk campaigns from the WordPress admin
* Automatic contact creation in MailCannon when sending

= Admin Menu =

After activation you will see:

* MailCannon
* Dashboard
* Campaigns
* Send Campaign
* Settings

= API Endpoint Used =

API Documentation: [https://mailcannon.pro/docs](https://mailcannon.pro/docs)

The plugin sends campaigns via:

* POST [https://mailcannon.pro/api/v1/send-email-campaign-by-id](https://mailcannon.pro/api/v1/send-email-campaign-by-id)

Headers:

* X-API-KEY: API_KEY
* Content-Type: application/json

Example request:

{
  "campaign_id": "123",
  "recipients": [
    "user@email.com",
    "customer@email.com"
  ]
}

== Installation ==

= Method 1 - WordPress Admin =

1. Download the plugin ZIP.
2. Go to Plugins > Add New > Upload Plugin.
3. Upload the ZIP file and click Install Now.
4. Activate the plugin.

= Method 2 - Manual FTP Installation =

1. Unzip the plugin archive.
2. Upload the mailcannon-plugin folder to wp-content/plugins/.
3. Go to Plugins and activate MailCannon.

== Configuration ==

1. Install and activate the plugin.
2. In WordPress admin, open MailCannon > Settings.
3. Get your API key from:
   [https://mailcannon.pro/dashboard/settings](https://mailcannon.pro/dashboard/settings)
4. Paste the API key and click Save.
5. Click Test Connection.

== How To Send a Campaign ==

1. In WordPress admin, open MailCannon > Send Campaign.
2. Select a MailCannon campaign.
3. Select recipients.
4. Click Send Campaign.

== Recipients Source ==

Recipients are selected from your WordPress site:

* WordPress users
* WooCommerce customers when WooCommerce is installed

== Contact Sync Behavior ==

Contacts are created or updated in MailCannon when you send a campaign.

Manage contacts in:
[https://mailcannon.pro/dashboard/contacts](https://mailcannon.pro/dashboard/contacts)

== External Services ==

This plugin relies on the MailCannon external service to list campaigns, test the API connection, and send email campaigns from your WordPress admin.

MailCannon is an email marketing platform used by this plugin to retrieve the campaigns available in your MailCannon account and to trigger campaign sending to the recipients you select in WordPress.

Data sent to MailCannon and when it is sent:

* When you save and use your API key, the plugin sends the API key in the X-API-KEY request header whenever you test the connection, refresh campaigns, open the campaigns screen, or open the send campaign screen.
* When you test the connection or fetch campaigns, the plugin sends your API key and requests your campaign list from [https://mailcannon.pro/api/v1/campaigns](https://mailcannon.pro/api/v1/campaigns).
* When you send a campaign, the plugin sends your API key, the selected MailCannon campaign ID, and the selected recipient email addresses to [https://mailcannon.pro/api/v1/send-email-campaign-by-id](https://mailcannon.pro/api/v1/send-email-campaign-by-id).
* Recipient data is sent only when an authorized admin or editor submits the send campaign form from WordPress.

This service is provided by MailCannon:

* Terms of Service: [https://mailcannon.pro/terms-of-service](https://mailcannon.pro/terms-of-service)
* Privacy Policy: [https://mailcannon.pro/privacy-policy](https://mailcannon.pro/privacy-policy)

== Security ==

This plugin follows WordPress security best practices:

* WordPress nonces for all admin form submissions
* Sanitization of all incoming input
* Output escaping in admin views
* Capability checks to restrict access to authorized roles administrator and editor

== Frequently Asked Questions ==

= Where do contacts come from? =

Recipients come from your WordPress users and optionally WooCommerce customers. Contacts are not stored in WordPress.

= Where do I manage contacts? =

Contacts are managed in MailCannon:
[https://mailcannon.pro/dashboard/contacts](https://mailcannon.pro/dashboard/contacts)

= Where do I manage campaigns? =

Campaigns are created and managed in your MailCannon account. The plugin fetches campaigns from MailCannon and lists them under MailCannon > Campaigns.

= Why are emails sent through MailCannon? =

MailCannon provides email campaign infrastructure, analytics, and deliverability features. This plugin uses MailCannon's API so campaigns can be sent reliably at scale.

= I do not see any campaigns in WordPress. What should I check? =

* Confirm your API key is saved in MailCannon > Settings
* Click Test Connection
* Ensure campaigns exist in your MailCannon account
* Go to MailCannon > Campaigns and click Refresh

== Screenshots ==

1. Dashboard
2. Campaigns list
3. Send Campaign campaign selection
4. Send Campaign recipient selection
5. Settings page

== Changelog ==

= 1.0.1 =

* Fix WordPress.org readme and plugin metadata warnings.
* Add required external services disclosure.
* Replace inline admin debug script with proper WordPress enqueue handling.

= 1.0.0 =

* Initial release.

== Upgrade Notice ==

= 1.0.1 =

Fixes WordPress.org metadata and readme issues and improves plugin review compliance.
