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.

Installation

$ pip install pymailcheck

Usage

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

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

yahoo.com

top_level_domains

pymailcheck.TOP_LEVEL_DOMAINS

yahoo

second_level_domains

pymailcheck.SECOND_LEVEL_DOMAINS

com

>>> pymailcheck.suggest("test@contosl.com")
False
>>> custom_domains = ["example.com", "contoso.com"]
>>> pymailcheck.suggest("test@contosl.com", domains=custom_domains)
{'domain': 'contoso.com', 'full': 'test@contoso.com', 'address': 'test'}
>>> pymailcheck.suggest("test@contosl.com")
False
>>> custom_domains = pymailcheck.DOMAINS.union(("example.com", "contoso.com"))
>>> pymailcheck.suggest("test@contosl.com", domains=custom_domains)
{'domain': 'contoso.com', 'full': 'test@contoso.com', 'address': 'test'}
>>> def my_distance_function(s1, s2): ...
>>> # Have a look at `strsim` PyPI package, for example
>>> pymailcheck.suggest("test@contosl.com", distance_callable=my_distance_function)
{'domain': 'contoso.com', 'full': 'test@contoso.com', '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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pymailcheck-1.1.0.tar.gz.

File metadata

  • Download URL: pymailcheck-1.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for pymailcheck-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5320337794ccc124b6178bb0b9de44b1a479674f99ddd05b8558bf6c718bdc0c
MD5 87875610495d9780f3edad9b390f0187
BLAKE2b-256 2ea297c2fdd8735f9fd73b2d6cb8fc34915027cb8dd77592860b2d4b7ec317e5

See more details on using hashes here.

File details

Details for the file pymailcheck-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pymailcheck-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for pymailcheck-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5b4bb44fb65061713626f371a9c9313a1cf169bfdacd5e36391509e904a7b6b
MD5 b0e442435aae2ee51dac9d1d51522d33
BLAKE2b-256 5673f85e65681ff1d019b9f56b51a2cfc05765a464436fbaec4effed2cf52d2c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page