Integrations · Sales outreach
Validate your Emelia contacts
Check the email addresses of the contacts in an Emelia list and write each result into four contact variables, so each contact shows whether its address is worth mailing. A script you run on your own computer reads the list, checks the addresses as one bulk list and writes the results back. It never deletes a contact, changes its address or name, or calls a campaign route (Emelia itself resynchronizes the campaigns that use the list after each contact update). Download it: email-validation-emelia.zip holds emelia.mjs (the script) and the MIT licence.
What you need
- A computer with Node 22.18 or later. Nothing to install: the script has no dependencies.
- An API key of ours from the API keys page with Validate addresses, and the permission Bulk lists (off by default: turn it on when you create the key) for more than 50 contacts.
- An Emelia API key: in Emelia, Settings, API & Webhooks, Create new key. An Emelia key opens the whole account, so create one for the script alone and delete it when you stop using it.
- The id of the list to check, as
EMELIA_LIST_ID: the 24 letters and digits in the list's address in Emelia. One run checks one list. Keep the list's Email column visible in its table: Emelia's API leaves hidden columns out, so the script stops and asks you to show the Email column if it is hidden.
The script declares its four variables in your Emelia account on its first run (Emelia variables are shared by all your lists).
Try it free first
Each checked address can use one credit, so try it with a list that holds only test contacts, never your real ones. Give one test contact the address no_mailbox@sandbox.email-validation.org (sandbox checks are free; that domain receives no mail, so send it nothing), then:
cd email-validation-emelia # the unzipped folder
export EMELIA_API_KEY=… EMELIA_LIST_ID=… EV_API_KEY=…
node emelia.mjs --dry-run # checks nothing, writes nothing: only counts
node emelia.mjs # checks and writesIn Windows PowerShell (5.1 or 7):
cd email-validation-emelia # the unzipped folder
$env:EMELIA_API_KEY = "…"; $env:EMELIA_LIST_ID = "…"; $env:EV_API_KEY = "…"
node emelia.mjs --dry-run # checks nothing, writes nothing: only counts
node emelia.mjs # checks and writesThe contact's ev_status variable says invalid and ev_reason says no_mailbox. Run it once more: it reports nothing to check, because every result was written. Then delete the test contact.
Run it
node emelia.mjs --dry-run # how many contacts would be checked; free
node emelia.mjs # checks and writesUp to 50 addresses are checked one by one; more go out as one bulk list. A contact whose address already has a result is skipped (an unknown result is checked again), so a daily run checks only new and changed addresses. If a run stops, run the same command again from the same folder: it resumes the same bulk list and never pays twice (within the 30 days a list is kept). The state file (.ev-emelia-<list id>.json) lives in that folder. It prints ids and counts, never an address or a key.
Emelia's list pages carry only the visible columns, so the script reads each contact in full once more by its address, one request at a time after its page; Emelia does not count its list and contact calls in its per-minute quota (a call over that quota gets a 500 with no Retry-After; Emelia answers 429 only on some routes). When Emelia answers 429 or 500, or is briefly unavailable (502, 503, 504), the script tries again three times (after 2, 4 and 8 seconds, or the wait a Retry-After names, up to a minute), then stops; run the same command again, which resumes without paying twice.
Options:
--region eu: checked in the EU, lists and results kept there, with the same key.--revalidate: check again addresses that already have a result.--state FILE: a state file of your own choosing.--rate N: list pages and writes a second (default 4, 10 at most); a page's contacts are then read one at a time.--wait-minutes N: how long to wait for a bulk list to finish (default 240); past it the script stops with exit code75, and the same command run later collects the list.--new-job: drop the saved bulk list (once it is no longer running) and start a new one for the contacts that still have no result; their addresses are charged again.
Exit codes: 0 done; 1 a write failed or the run stopped (run it again: nothing is paid twice); 2 wrong options; 75 the bulk list was still being checked when the script stopped waiting (run it again later to collect it).
What it writes
Four contact variables:
| Variable | Holds |
|---|---|
ev_status | valid, invalid, catch_all, unknown or disposable |
ev_reason | the reason, for example no_mailbox or accepted |
ev_checked_at | when it was checked |
ev_address_hash | a hash of the address the result belongs to, so a changed address is checked again |
Spam traps and complainers are valid with a warning reason: see what each status means. Each result is written by contact id, and only while the contact still holds the address that was checked; the write sends only the four variables, so nothing else of the contact changes, and the campaigns that use the list see the new values. The first write of a run is read back: if anything else of that contact changed, the script stops there and says so. A result that could not be written is kept in a file next to the state file and written by the next run without a new check.
End the access
Delete the Emelia API key in Settings, API & Webhooks, and our key on the API keys page. The four variables stay on your contacts until you remove them in Emelia.