On this page
- How email to address lookup works before an API mailing
- Email append or reverse email append: what to ask for before an API mailing
- What to send a data append service for an API mailing
- Clean the matched email list before an API mailing
- Check and send the matched addresses with the API
- Email subscribers and opt-outs in an API mailing
- Email to address lookup questions from API senders
How email to address lookup works before an API mailing
A data append service keeps records that tie email addresses to people and their postal addresses. You send it a file of emails. It looks each one up and sends the file back with a name, street, city, state and ZIP on the rows it matched. Rows it couldn’t match come back empty.
A row matches only when the service has that email on file with an address. Some services also take a first and last name with each email, because a known name helps them find the right person. A match can also be to the household instead of the person: the service doesn’t find your subscriber but does find someone who lives with them. Ask how the file marks the difference. It decides whose name goes on the card.
| name | address | match | |
|---|---|---|---|
| ada@example.com | Ada Park | 2 Elm St, Tempe | Matched |
| sam@example.com | — | — | No match |
| lena@example.com | Lena Ortiz | 9 Bay Ct, Mesa | Matched |
| marco@example.com | Lena Ortiz | 9 Bay Ct, Mesa | Household |
How much of a list matches depends on the list and the service. We don’t quote match rates here, because any number a service gives is its own claim about its own data. Have it run a sample of your list before you pay for the whole file, and ask whether you pay for every row you send or only for the rows it matches. Some services bill matches only.
Email append or reverse email append: what to ask for before an API mailing
The two names are easy to mix up, and asking for the wrong one gets you the wrong job. An email append starts from names and postal addresses and finds email addresses. Going from emails to postal addresses is a reverse email append. A data append service is any company that fills in missing fields like these on records you already have, so say which direction you want when you ask for a price.
| You have | You want | Ask for |
|---|---|---|
| Names and postal addresses | Email addresses | Email append |
| Email addresses | Names and postal addresses | Reverse email append |
What to send a data append service for an API mailing
- Your own record id on every row, so the results join back to your data.
- The email address. If you’d rather not send addresses in plain text, ask whether the service takes a hashed email instead.
- First and last name, if you have them.
Leave everything else out. Order history, notes and payment details don’t help anyone match an email.
What comes back is your file with new columns: the name, the street lines, city, state and ZIP, often with a status that says whether the row matched. Column names differ by service. Map them to your own before the next step; the script below expects line1, line2, city, state and zip.
Clean the matched email list before an API mailing
- Keep only the matched rows. A row with no street address can’t be mailed. Those people are still on your email list, so keep emailing them.
- Take out opt-outs. Anyone who unsubscribed from your email, or asked you not to contact them, stays off the mail list too.
- Mail each household once. Two emails can match the same address, like a couple who both signed up. Dedupe on the normalized address, as in targeted direct mail.
- Update older records for moves. An appended address is only as current as the service’s last update. Ask when its data last went through NCOA. If it can’t say, or it was more than 95 days ago, run NCOA on the matched rows yourself. 95 days is the window USPS uses in its Move Update rule for commercial First-Class Mail and USPS Marketing Mail prices.
- Check every address. Confirm each one is a real USPS delivery point before you pay to print it. What the check returns, code by code, is in CASS-certified address verification.
Check and send the matched addresses with the API
Mailr checks addresses two ways, at the same price: 7¢ an address on pay as you go.
"verify": trueon the batch checks every address as part of the send and mails each piece to the standardized address. If any address is undeliverable, the whole batch is rejected with a 422 that names the bad recipients, and nothing is created or charged.POST /v1/addresses/verifychecks up to 1,000 addresses on their own and returns each one’sdeliverability, the standardized address and a vacant flag. You decide what to mail.
For an appended list, check first. These addresses came from someone else’s records, and with "verify": true one bad row stops the whole batch. The script below drops unmatched rows, opt-outs and repeat households, checks the rest, and mails the deliverable addresses as 6x9 postcards, $0.89 each on pay as you go with printing and postage included (other sizes are on the pricing page). Every field it sends is in the API reference.
# Mail the rows a reverse email append matched. appended.csv is the file the data service sent back. Column names
# differ by service, so map yours to: id, email, name, first_name, line1, line2, city, state, zip (no match = no line1).
# optouts.csv: one email per line, everyone who unsubscribed or asked for no mail. Older records: run NCOA first.
import csv, os, re, requests
API = "https://api.mailr.dev/v1"
H = {"Authorization": f"Bearer {os.environ['MAILR_API_KEY']}"}
with open("optouts.csv", newline="") as f:
optouts = {row[0].strip().lower() for row in csv.reader(f) if row}
def household(r): # one card per address, even when two emails matched it
return re.sub(r"[^a-z0-9]", "", f"{r['line1']}{r['line2']}".lower()) + r["zip"][:5]
rows, seen = [], set()
with open("appended.csv", newline="") as f:
for r in csv.DictReader(f):
if not r["line1"].strip() or r["email"].strip().lower() in optouts or household(r) in seen:
continue # no match, opted out, or a household already on the list
seen.add(household(r))
rows.append(r)
send = []
for start in range(0, len(rows), 1000): # one check takes up to 1,000 addresses
chunk = rows[start:start + 1000]
res = requests.post(f"{API}/addresses/verify", headers=H, timeout=60, json={"addresses": [
{"name": r["name"][:40], "line1": r["line1"], "line2": r["line2"] or None,
"city": r["city"], "state": r["state"], "zip": r["zip"]} for r in chunk]})
res.raise_for_status()
for r, v in zip(chunk, res.json()["data"]):
if v["deliverability"] == "deliverable" and not v["vacant"]: # the rest: keep emailing them
send.append({"to": {**v["address"], "name": r["name"][:40]},
"merge": {"first_name": (r["first_name"] or "friend")[:14]}})
print(len(rows), "matched,", len(send), "to mail")
for n, start in enumerate(range(0, len(send), 1000)):
b = requests.post(f"{API}/batches", headers={**H, "Idempotency-Key": f"email-list-mailing-{n}"}, timeout=60, json={
"kind": "postcard", "size": "6x9",
"front": open("mail/front.html").read(), "back": open("mail/back.html").read(),
"recipients": send[start:start + 1000], "description": f"Email list mailing, part {n + 1}"})
b.raise_for_status()
print(b.json()["id"], b.json()["count"], b.json()["price"])mlr_test_ key first. The address check is a free simulation (any address with “undeliverable” in its first or second line fails), the batches are checked and priced, and nothing prints or charges.The batches carry the standardized addresses the check returned, so they don’t pay for a second check. Each one also sends an Idempotency-Key: if the script retries a request within 24 hours, Mailr returns the first batch instead of mailing it twice.
Email subscribers and opt-outs in an API mailing
People who gave you their email already know who you are. A card is one more way to reach them, and it can sound like your emails do, down to their first name and the thing they signed up for. The fields worth changing per card are in personalized direct mail, and ready-made designs are in the templates.
Some habits that help. This is practical advice, not legal advice:
- Mail people who signed up with you or bought from you, not a file of emails someone else collected.
- Keep one opt-out list for email and mail, and check it before every send, as the script does with
optouts.csv. - Give people a way to stop the mail. Put a line on the card, such as a link to your mail preferences, and add whoever uses it to the opt-out list.
- Put your name and logo up front. Someone who knows your emails may not recognize your postcard.
- Read the data service’s terms for what you may do with the addresses it returns, and for how long.
Email to address lookup questions from API senders
Does Mailr match emails to mailing addresses?
No. Mailr doesn't sell data or match emails. A data append service does the match; you send the matched addresses to Mailr, which can check each one and then prints and mails the pieces.
What is a reverse email append?
Matching email addresses to names and postal addresses. A plain email append goes the other way: it adds email addresses to a list of names and postal addresses.
How many of my emails will match?
That depends on your list and on the service, and any rate a service quotes is its own claim. Have it run a sample of your list first, then count the matched rows that pass an address check.
Do appended addresses need NCOA?
If the service's records weren't updated for moves in the last 95 days, yes, the same as any other list. Ask the service when it last ran NCOA; if it can't say, run it yourself.
What does mailing the matched list cost?
The lookup is the data service's price. On Mailr, an address check is 7¢ and a 6x9 postcard is $0.89 on pay as you go, printing and USPS postage included. Test keys cost nothing.