Prompt
How do I check a CSV of emails for typos and bad domains?
Latest observation
Oct 5, 2026
OpenAI APIWeb search: off
A practical way is to validate in three layers:
- Basic email format check
- Looks for things like missing
@, spaces, or no domain.
- Looks for things like missing
- Domain check
- Confirms the domain part exists and looks valid.
- Typos / bad-domain check
- Catches common mistakes like
gamil.cominstead ofgmail.com.
- Catches common mistakes like
Option 1: Use Python with a CSV
If you have a CSV with a column like email, you can use pandas.
Install
pip install pandas email-validator
Script
import pandas as pd
from email_validator import validate_email, EmailNotValidError
# Common domain typos / bad domains
COMMON_DOMAIN_FIXES = {
"gamil.com": "gmail.com",
"gnail.com": "gmail.com",
"hotnail.com": "hotmail.com",
"yahooo.com": "yahoo.com",
"outlok.com": "outlook.com",
"icloud.con": "icloud.com",
}
def check_email(email):
if pd.isna(email) or str(email).strip() == "":
return "missing"
email = str(email).strip()
# Format check
try:
v = validate_email(email, check_deliverability=False)
normalized = v.email
except EmailNotValidError:
return "bad_format"
# Domain typo check
domain = normalized.split("@")[-1].lower()
if domain in COMMON_DOMAIN_FIXES:
return f"typo_domain -> {COMMON_DOMAIN_FIXES[domain]}"
return "ok"
df = pd.read_csv("emails.csv")
df["email_check"] = df["email"].apply(check_email)
# Save results
df.to_csv("emails_checked.csv", index=False)
# Show suspicious rows
print(df[df["email_check"] != "ok"])
Option 2: Add live domain/deliverability checking
If you want to catch domains that don’t actually exist, set:
validate_email(email, check_deliverability=True)
That checks DNS/MX records, but note:
- it may be slower
- it can be blocked by network/DNS issues
- some valid domains don’t have MX in the usual way
Option 3: Use Excel / Google Sheets
If you just need a quick pass:
- Use formulas to flag malformed emails
- Extract the domain and compare it to a list of known-good domains
- Use conditional formatting to highlight suspicious entries
Example to get the domain from A2:
=RIGHT(A2,LEN(A2)-FIND("@",A2))
Then compare against a reference list of accepted domains.
Good typo checks to include
Common misspellings:
gamil.com→gmail.comhotnail.com→hotmail.comoutlok.com→outlook.comyaho.com→yahoo.comicloud.con→icloud.com
You can expand the mapping based on your audience.
Best practice
For a CSV list, I’d recommend:
- syntax validation
- domain typo mapping
- optional DNS/MX verification
- export flagged rows for review
If you want, I can give you:
- a ready-to-run Python script
- an Excel formula solution
- or a version that checks common typos automatically with fuzzy matching