=== Lijn-B Mailflow ===
Contributors: lijn-b
Donate link: https://ko-fi.com/lijnb
Tags: email automation, newsletter, contacts, mailing list, campaigns
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.5.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Email automation for your own WordPress site: contacts, lists and tags, email sequences after a signup, and one-off campaigns. Works with Lijn-B Forms. No subscription, no premium version.

== Description ==

Someone signs up. And then? Lijn-B Mailflow keeps your contacts in your own WordPress database, organises them in lists and tags and sends them a series of emails at the moments you choose.

Features:

* Contacts with a status (subscribed, waiting for confirmation, unsubscribed, bounced), lists and tags, search and filters, bulk actions, CSV import (with a consent checkbox) and export, and a history per contact.
* Automations built in the admin: start with a form, a tag, a list, a new contact or manually. Steps: send an email, wait (minutes, hours, days, or until a time such as 07:00), add or remove a tag or list, notify yourself, and stop if (tag or list).
* A simple email editor with merge tags such as `{voornaam|jij}`, buttons, images, a preview and a test mail.
* Form link: choose a form from Lijn-B Forms, map email, name and a consent checkbox, put the contact on a list and give it tags. Double opt-in is optional.
* Unsubscribe and privacy: an unsubscribe link in every email with confirmation, List-Unsubscribe and one-click unsubscribe (RFC 8058), unsubscribed contacts never receive mail, delete a contact completely, WordPress export and erase tools, and no open or click tracking.
* Sending through your site's own mail (use an SMTP plugin if you like), with a queue per minute, a limit on mails per minute, three attempts, a log and a warning if WP-Cron stops.
* Campaigns: a one-off email to one or more lists, excluding a tag, with preview and test mail, send now or schedule, pause, resume and cancel, and progress per recipient.
* Optional Postmark sending with separate transactional and broadcast streams and a webhook that handles bounces, spam complaints and unsubscribes.
* English and Dutch admin interface (gettext translations).
* Self-hosted automatic update checks from the Lijn-B update manifest.
* Built-in support button for the plugin author at ko-fi.com/lijnb.

Not included: A/B tests, if/else branching in automations and a block-based email editor.

== Installation ==

1. Upload the `lijnb-mailflow` directory to `/wp-content/plugins/`.
2. Activate Lijn-B Mailflow in WordPress.
3. Open Mailflow > Settings and set the sender name, sender address and the postal address that appears at the bottom of every email.
4. Recommended: let a real server cron job call `wp-cron.php` every minute and set `DISABLE_WP_CRON` to `true`.
5. Build your first automation under Mailflow > Automations.

== Frequently Asked Questions ==

= Do I need Postmark? =

No. Mailflow sends through your site's own mail by default. Postmark is optional and gives better delivery and automatic bounce handling. Store the token in `wp-config.php` as `LBM_POSTMARK_TOKEN`.

= Does it track opens and clicks? =

No. There is no open or click tracking.

= Is double opt-in supported? =

Yes, as an option. People then confirm their signup by email.

= How are emails sent? =

In a queue, once per minute through WP-Cron, with a limit on mails per minute. For reliable timing a real server cron job is recommended.

= Why do I need a real cron job, and how do I set one up? =

Mailflow sends email from a queue that must be picked up every minute. WordPress' own scheduler, WP-Cron, is not a real cron: it has no clock and only wakes up when someone visits your site. On a quiet site, a staging site or a site with page caching, scheduled emails then arrive late or not at all. A real cron job on your hosting fixes that.

1. Create a cron job that runs every minute (timing `* * * * *`) with the command `curl -s "https://example.com/wp-cron.php?doing_wp_cron" > /dev/null 2>&1`. Use your own domain.
2. Check that it works: the warning on the Mailflow overview page is gone and the queue empties.
3. Then add `define( 'DISABLE_WP_CRON', true );` to wp-config.php, above the line "That's all, stop editing!".

Plesk: Websites & Domains > your domain > Scheduled Tasks > Add Task. Task type "Fetch URL", the address above, run "Cron style" `* * * * *`, notifications off.
cPanel: Advanced > Cron Jobs > Common Settings > "Once Per Minute (* * * * *)", paste the command, Add New Cron Job.
DirectAdmin: Advanced Features > Cron Jobs > Create Cron Job. Put a `*` in all five boxes (minute, hour, day of month, month, day of week), paste the command, Create.

No cron access? Use a free outside service such as cron-job.org to open the same address every minute. A longer guide with explanations and troubleshooting is included in the plugin folder: `docs/cron-guide.md`.

= What happens to my data when I delete the plugin? =

By default nothing is deleted, so deleting the plugin by mistake costs you nothing. If you want everything removed, tick "Delete all data when this plugin is deleted" under Mailflow > Settings. Mailflow also asks once when you deactivate it, because a deactivated plugin is no longer loaded and cannot ask at the moment you delete it.

== External services ==

* Postmark (optional, off by default): if you enable it, emails and contact addresses are sent to the Postmark API (https://postmarkapp.com). See https://postmarkapp.com/privacy-policy.
* Update check: WordPress asks https://lijn-b.nl/lijnb-mailflow/update.json for new versions. Only the plugin name and version are sent; the request does not contain your site address.

== Changelog ==

= 0.5.1 =
* You choose what happens to your data when the plugin is deleted: a checkbox under Mailflow > Settings, and a question the first time you deactivate the plugin. By default nothing is deleted.
* New guide for setting up a real cron job (why WP-Cron is not enough, and how to do it in Plesk, cPanel and DirectAdmin), in the FAQ and in `docs/cron-guide.md`.

= 0.5.0 =
* English source text with a complete Dutch translation (nl_NL and nl_BE) for the whole admin, the emails and the pages visitors see, ready for more languages (gettext).
* Plural forms and complete sentences for translators; the mail template follows the site language.

= 0.4.1 =
* Works with Lijn-B Forms (renamed). Updates via an update.json on lijn-b.nl, the same model as DayOneWP.

= 0.4.0 =
* New name: Lijn-B Mailflow (was Lijn-B Mail), because the plugin is email automation: contacts, lists, tags, sequences and campaigns.
* Updates through lijn-b.nl, including WordPress automatic updates.
* A discreet Ko-fi donation link on the plugin row and at the bottom of the settings page. The plugin stays free.
* When switching from Lijn-B Mail: the database stays the same (prefix `lbm_`), but the REST namespace is now `lijnb-mailflow/v1` and hooks are `lijnb_mailflow/...`.

= 0.3.0 =
* Campaigns and sending through Postmark (separate broadcast stream, webhook for bounces and complaints).

== Upgrade Notice ==

= 0.5.1 =
New: choose whether your data is deleted when the plugin is deleted, and a guide for setting up a real cron job.

= 0.5.0 =
Translatable: English is the source language and Dutch is included. Default texts saved on installation (footer, confirmation mail) stay in the language they were saved in.

= 0.4.0 =
Renamed from Lijn-B Mail. Deactivate the old plugin first; contacts, lists and automations are kept.
