Skip to main content

Suggest corrections to user-misspelled email addresses

Project description

Suggest corrections to user-misspelled email addresses.

Python port of mailcheck.js.


$ pip install pymailcheck


>>> import pymailcheck
>>> pymailcheck.suggest("test@example.con")
{'domain': '', 'full': '', 'address': 'test'}
>>> pymailcheck.suggest("")

You can override or append the built-in list of domains, top-level domains, and/or second-level domains:

Parameter Defaults Example
domains pymailcheck.DOMAINS
top_level_domains pymailcheck.TOP_LEVEL_DOMAINS yahoo
second_level_domains pymailcheck.SECOND_LEVEL_DOMAINS com
>>> pymailcheck.suggest("")
>>> custom_domains = ["", ""]
>>> pymailcheck.suggest("", domains=custom_domains)
{'domain': '', 'full': '', 'address': 'test'}
>>> pymailcheck.suggest("")
>>> custom_domains = pymailcheck.DOMAINS.union(("", ""))
>>> pymailcheck.suggest("", domains=custom_domains)
{'domain': '', 'full': '', 'address': 'test'}
>>> def my_distance_function(s1, s2): ...
>>> # Have a look at `strsim` PyPI package, for example
>>> pymailcheck.suggest("", distance_callable=my_distance_function)
{'domain': '', 'full': '', 'address': 'test'}

Running Tests

$ python -m unittest discover

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymailcheck-1.1.0.tar.gz (4.7 kB view hashes)

Uploaded source

Built Distribution

pymailcheck-1.1.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page