email-domain-typo-finder

Crystal command line tool and library. Give it a text file with one email address per line and it flags every address whose domain is not a common mailbox domain but is one or two typed characters away from exactly one (gmial.com, yaho.com, outlok.com), then prints the corrected address. Distance is Levenshtein edit distance: 1 always, 2 only when the domain is 6 or more characters. A domain close to more than one known domain is left alone. Built in list: gmail.com, yahoo.com, outlook.com, hotmail.com, icloud.com, aol.com, proton.me, live.com, msn.com. Add your own with --domains FILE (one domain per line).

Part of the OneGTMLab free GTM tools. Background on the idea: email finder.

Install

shards build   # then ./bin/email-domain-typo-finder

Use

Input: one email address per line. Blank lines are skipped; a line without a single @ stops the run with an error naming the line. Output: line, address, suggestion, distance, then the counts checked, suspected typos and clean.

$ ./bin/email-domain-typo-finder sample.txt
line  address         suggestion       distance
2     [email protected]   [email protected]    2
3     [email protected]   [email protected]   1
5     [email protected]  [email protected]  1
6     [email protected]  [email protected]  1
7     [email protected]  [email protected]   1
10    [email protected]   [email protected]    1
11    [email protected]       [email protected]       1

checked: 10
suspected typos: 7
clean: 3

Test

crystal spec

Offline, no network calls, no dependencies beyond the language runtime. MIT licensed.