=== Sendigram Mail ===
Contributors: sendigram
Tags: email, newsletter, contacts, sync, email marketing
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WordPress to the Sendigram EMS: synchronize your WordPress users into Sendigram contacts with flexible field mapping.

== Description ==

Sendigram Mail is the official WordPress plugin of [Sendigram](https://sendigram.com), developed and maintained by Sendigram Pty Ltd, the company that operates the Sendigram email marketing platform. It connects your WordPress site to Sendigram (campaigns, contacts, forms).

The plugin ships **Users Synchronization**: export your WordPress users into Sendigram contacts, straight from the WordPress admin.

= Features =

* **One-click connection** — connect with a Sendigram API key; the key is validated before it is saved and is never shown back in clear text.
* **Users Synchronization** — export WordPress users into Sendigram contacts:
    * pick which **roles** to sync;
    * add the contacts to one or more Sendigram **groups**;
    * map WordPress profile fields (first/last name, display name, username, website, registered date, biography, roles) to Sendigram **attributes** — email is always mapped automatically;
    * choose whether **existing contacts** (matched by email) are updated or left unchanged.
* **Background processing** — synchronization runs in the background in batches of 250 users, so large sites never block the browser or hit request timeouts. Progress, cancellation, and a final Created / Updated / Skipped / Failed summary are shown in the admin dialog.
* **Reliable confirmations** — batch results arrive via a webhook; if your site is not reachable from outside (basic auth, staging, local dev), the plugin polls Sendigram directly instead, so runs still complete.
* **Clean lifecycle** — deactivation keeps your settings and log; uninstalling removes everything the plugin stored.

A Sendigram account (free or paid) with an API key is required. You can create one at [ems.sendigram.com/signup](https://ems.sendigram.com/signup).

= External services =

This plugin connects to the **Sendigram API** (`https://ems.sendigram.com`), operated by Sendigram Pty Ltd. It is required for everything the plugin does — the plugin is an integration client for this service.

What is sent, and when:

* **API key validation** — when you connect (and when the plugin re-checks a stored key), the API key you entered is sent to Sendigram to verify it is valid.
* **Groups and attributes** — when you open the synchronization dialog, the plugin fetches your contact groups and attributes from Sendigram.
* **Contact data** — when you start a synchronization, the plugin sends the selected WordPress users' data to Sendigram: their email address plus any profile fields you mapped (e.g. first name, last name, website, registered date). Nothing is sent until you explicitly start a run.
* **Import status** — after a run, the plugin may query Sendigram for the status of dispatched batches.

No data is sent on activation, and no telemetry or analytics are collected. All requests go only to the API base URL configured in the plugin settings (default `https://ems.sendigram.com/open-api/v1`).

Sendigram terms and privacy policy: [Terms of Use](https://sendigram.com/terms-of-use), [Privacy Policy](https://sendigram.com/privacy-policy).

== Installation ==

1. Install the plugin from the WordPress.org directory (or upload the ZIP via **Plugins → Add New → Upload Plugin**).
2. Activate it on the **Plugins** screen.
3. Open the new **Sendigram Mail** item in the admin menu.
4. Create a Sendigram account (or log in) and get your API key from the Sendigram dashboard.
5. Paste the API key and click **Connect**.
6. Use the **Users Synchronization** card to sync your WordPress users into Sendigram contacts.

== Frequently Asked Questions ==

= Do I need a Sendigram account? =

Yes. The plugin is an integration with the Sendigram platform, so a Sendigram account (free or paid) with an API key is required. Without it the plugin has nothing to connect to.

= What data does the plugin send to Sendigram? =

Only what you ask it to: when you start a synchronization, the selected users' email addresses and the profile fields you mapped are sent to your Sendigram account. See the "External services" section above for the full list.

= Where is my API key stored? =

On your server, in the WordPress options table. It is never returned to the browser in clear text — the admin UI only shows a masked version.

= Does synchronization work on large sites? =

Yes. Users are processed in background batches of 250 via WP-Cron, so the run does not depend on keeping a browser tab open (as long as WP-Cron works on your host). If WP-Cron cannot run, the plugin falls back to dispatching batches from your admin requests and tells you so in the dialog.

= What happens when I uninstall the plugin? =

Deactivation keeps all settings and the import log. Uninstalling (deleting the plugin) removes the plugin's options, cache, sync state, and its database table completely.

== Screenshots ==

1. Connection screen with the two-step onboarding: create a Sendigram account and connect with an API key.
2. Connected state: connection status, masked API key, and the Users Synchronization card.
3. Users Synchronization dialog: role selection, target groups, attribute mapping, and the update-existing option.

== Changelog ==

= 1.2.6 =
* Plugin header and readme now state explicitly that this is the official Sendigram plugin by Sendigram Pty Ltd. No functional changes.

= 1.2.5 =
* Translations are now delivered through translate.wordpress.org language packs: bundled catalogs and the load_plugin_textdomain() call were removed.

= 1.2.4 =
* Code-quality pass driven by the Plugin Check plugin: identifier placeholders (%i) in all custom-table queries, debug logging gated behind WP_DEBUG, heredoc removed.

= 1.2.3 =
* Initial release on WordPress.org.
* Connect to Sendigram with an API key (validated before saving, stored masked).
* Users Synchronization: role selection, target groups, attribute mapping, update-existing option.
* Background batch processing with progress, cancellation, and a final summary.
* Webhook confirmations with a direct-poll fallback for sites not reachable from outside.

== Development ==

The JavaScript shipped in `assets/build/` is a minified production build made with `@wordpress/scripts` (`wp-scripts build`). The corresponding unminified sources are included in the plugin package under `assets/src/`.
