Integrations · Email platforms

Validate your MailerLite subscribers

Check the addresses of a MailerLite group or segment and save each subscriber's result in four custom fields, so a segment can leave out the addresses you should not mail. Two pieces, use either or both: a sync script you run on your own computer checks a whole group or segment as one bulk list, and a small relay you deploy to your own Cloudflare account checks each new subscriber as they sign up. Neither one deletes or unsubscribes anyone. The script and the relay are in email-validation-mailerlite.zip: mailerlite.mjs (the sync script), relay.mjs (the relay), webhook.json and the MIT licence. This works with the current MailerLite, not MailerLite Classic.

Create a MailerLite API token

In MailerLite, open Integrations (left menu) → MailerLite API → Use, then Generate new token. Give it a name and select Create token; MailerLite can also restrict it to IP addresses (leave that off for the relay, which has no fixed address). MailerLite shows the token once: copy it. A token can do everything in your account, so keep it secret. On MailerLite's Free plan the API and webhooks are limited, and the plan holds up to 250 subscribers: check MailerLite's pricing page for what your plan includes.

What it writes

FieldValue
ev_statusvalid, invalid, catch_all, unknown or disposable (statuses)
ev_reasonwhy, for example accepted, no_mailbox, spamtrap
ev_actionsend, send_with_caution, remove or retry_later
ev_checked_atwhen the check ran, in UTC

If your account does not have these fields yet, the first run creates them as Text fields (MailerLite allows up to 200 fields per account, its default ones included). Make a segment where ev_action is remove to find every subscriber you should not mail, spam traps and complainers included: they are valid with the action remove, so trust ev_action, not ev_status. Each write changes only these four fields: no subscriber is created, unsubscribed or deleted, and their status and groups stay as they are.

Run it yourself: the sync script

It needs Node 22.18 or later (nothing to install: it has no dependencies), an API key of ours from the API keys page with the permission Bulk lists (off by default: turn it on when you create the key), and the MailerLite token above. A group's id is the long number in the address of the group's page in MailerLite.

cd email-validation-mailerlite                           # the unzipped folder
export EV_API_KEY=…  MAILERLITE_API_KEY=…
node mailerlite.mjs --group <group id> --dry-run         # counts what it would check; spends and writes nothing
node mailerlite.mjs --group <group id>                   # checks and writes the four fields

Try it free first: in MailerLite, make a test group that no automation of yours mails, and add one subscriber to it by hand with the address no_mailbox@sandbox.email-validation.org (a test address: free, and it receives no mail, so keep it out of campaigns). Run the script on that group: the subscriber gets ev_status invalid and ev_action remove. Then delete the test subscriber, and run it on your real group, --dry-run first.

  • Only active subscribers are checked, and only those without a result (or with unknown); --revalidate checks them all again.
  • --suppress also takes the subscribers whose action is remove out of the group. They stay in your account, active, with their fields and other groups: nothing is unsubscribed or deleted.
  • --segment <segment id> checks a segment instead (without --suppress).
  • --region eu checks and keeps the list in the EU, with the same key. node mailerlite.mjs --setup only creates the four fields.

The script does not ask before it spends: each distinct address uses one credit; unknown results, duplicates, malformed and test addresses are free. It prints subscriber ids, job ids and counts, never an address or a token.

Run it again

Run the same command again after any stop (no credits, a closed laptop, MailerLite's limit, the bulk list still running): it resumes the same bulk list and never pays twice (within the 30 days a list is kept). Run it from the same folder each time (or pass the same --state FILE): the file it keeps there holds the bulk list it is working on, never an address or a key. When every subscriber is written, the file is removed and the next run checks only subscribers without a result, so you can run it on a schedule, for example daily with cron, with both keys set.

MailerLite allows 120 requests a minute for the whole account, so your other connected apps count toward it too. The script sends 100 a minute by default (--rate N, at most 120) and writes 50 subscribers per request; when MailerLite says the limit is reached, it waits as long as MailerLite asks. The check itself runs on our side and is not slowed by MailerLite.

Exit codes: 0 done, 1 a write failed or the run stopped (run it again), 2 wrong arguments, 75 the bulk list was still running when the script stopped waiting (run it again later).

Check new subscribers as they sign up

The relay is a Cloudflare Worker in your own account. It needs an API key of ours with Validate addresses (on by default) and your MailerLite token. Create the four fields first (a run of the script or node mailerlite.mjs --setup): without them the relay checks nothing. No terminal? Deploy it from the Cloudflare dashboard instead (creating the webhook still takes the one curl call below, which any computer with a terminal can send). Or deploy it from the unzipped folder:

npx wrangler deploy relay.mjs --name ev-mailerlite-relay --compatibility-date 2026-10-01
npx wrangler secret put EV_API_KEY --name ev-mailerlite-relay          # our API key
npx wrangler secret put MAILERLITE_API_KEY --name ev-mailerlite-relay  # your MailerLite token

Add --var EV_REGION:eu to the deploy command to have addresses validated in the EU and their results stored there.

Then create the webhook. In webhook.json, replace the url with the relay's address and send it to MailerLite:

curl -H "Authorization: Bearer $MAILERLITE_API_KEY" -H 'Content-Type: application/json' --data @webhook.json \
  https://connect.mailerlite.com/api/webhooks

MailerLite answers with the webhook's secret. Put it into the relay:

npx wrangler secret put MAILERLITE_WEBHOOK_SECRET --name ev-mailerlite-relay   # the webhook's secret

The relay acts on new subscribers of the whole account (the event subscriber.created). To check only sign-ups to one group, add --var MAILERLITE_GROUP_ID:<group id> to the deploy command and use the event subscriber.added_to_group in webhook.json instead. Keep the webhook not batchable: the relay ignores batched deliveries.

Deploy the relay from the Cloudflare dashboard

  1. In the Cloudflare dashboard, open Workers & Pages → Create and choose Create Worker (the "Hello World" starter). Name it ev-mailerlite-relay and select Deploy.
  2. Select Edit code, delete the starter code, paste the whole of relay.mjs from the box below (Copy takes all of it) and select Deploy.
  3. In the Worker's Settings → Variables and Secrets, select Add for each value below, then Deploy:
    • type Secret: EV_API_KEY (our API key), MAILERLITE_API_KEY (your MailerLite token) and, once you have created the webhook as above, MAILERLITE_WEBHOOK_SECRET (the secret MailerLite answered);
    • type Text, if you want them: MAILERLITE_GROUP_ID = the one group to check, and EV_REGION = eu.
  4. The relay's address, such as https://ev-mailerlite-relay.<your-subdomain>.workers.dev/, is on the Worker's page: use it as the url of the webhook.

Or open relay.mjs as plain text in a new tab, select all of it and copy it from there.

Who can call the relay

MailerLite signs every delivery with the webhook's secret, and the relay checks only deliveries signed with it. A subscriber that already has a result is not checked again, so a delivery MailerLite sends again costs nothing. Whether an import into MailerLite sends an event for each imported subscriber is not documented: after an import, run the sync.

Try it once: add a test subscriber by hand with the address no_mailbox@sandbox.email-validation.org to a group that no automation of yours mails. Within a few seconds it should have ev_status invalid and ev_action remove. Then delete it. From then on every new subscriber is a paid check, one credit each.

Good to know

  • Ending the access. Delete the relay's webhook and Worker, and delete the token in MailerLite (Integrations → MailerLite API).
  • Free checks. Results with the status unknown are free, and so are malformed addresses, duplicates and test addresses.

More on MailerLite

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us