Skip to main content

Simple, robust email validation

Project description

Latest version released on PyPI ci Test coverage downloads

Getting Started

pyIsEmail is a no-nonsense approach for checking whether that user-supplied email address could be real. Sick of not being able to use email address tagging to sort through your Bacn? We can fix that.

Regular expressions are cheap to write, but often require maintenance when new top-level domains come out or don’t conform to email addressing features that come back into vogue. pyIsEmail allows you to validate an email address – and even check the domain, if you wish – with one simple call, making your code more readable and faster to write. When you want to know why an email address doesn’t validate, we even provide you with a diagnosis.

Install

Install from PyPI using pip, a package manager for Python.

$ pip install pyIsEmail

Don’t have pip installed? Try installing it by running this from the command line:

$ curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

Or you can download the source code (zip) for pyIsEmail and then run:

$ python setup.py install

You may need to run the above commands with sudo.

Usage

For the simplest usage, import and use the is_email function:

from pyisemail import is_email

address = "test@example.com"
bool_result = is_email(address)
detailed_result = is_email(address, diagnose=True)

You can also check whether the domain used in the email is a valid domain and whether or not it has a valid MX record:

from pyisemail import is_email

address = "test@example.com"
bool_result_with_dns = is_email(address, check_dns=True)
detailed_result_with_dns = is_email(address, check_dns=True, diagnose=True)

These are primary indicators of whether an email address can even be issued at that domain. However, a valid response here is not a guarantee that the email exists, merely that is can exist.

If you want to limit using a gTLD as the domain part of the email address, you can do so with a flag:

from pyisemail import is_email

address = "thiswont@workatall"
bool_result_with_check = is_email(address, allow_gtld=False)
detailed_result_with_check = is_email(address, allow_gtld=False, diagnose=True)

In addition to the base is_email functionality, you can also use the validators by themselves. Check the validator source doe to see how this works.

Uninstall

Want to get rid of pyIsEmail? Did you install with pip? Here you go:

$ pip uninstall pyIsEmail

Acknowledgements

The base ParserValidator is based off of Dominic Sayersis_email script. I wanted the functionality in Python, so I ported it from the original PHP.

Contributing

So you’re interested in contributing to pyIsEmail? Check out our contributing guidelines for more information on how to do that.

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs.

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

pyisemail-2.0.1.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

pyisemail-2.0.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file pyisemail-2.0.1.tar.gz.

File metadata

  • Download URL: pyisemail-2.0.1.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for pyisemail-2.0.1.tar.gz
Algorithm Hash digest
SHA256 daf4b3fb2150a38f406b0aaba729e19fcd638a6d1c0549c25ff54c7b804618f8
MD5 33006d869fc34cfd75ef6d6b6d0fefaa
BLAKE2b-256 078db73f5154bc0c5bae1f83117a7095d4ca1c369ad0f3d65de27cf5c2b0b185

See more details on using hashes here.

File details

Details for the file pyisemail-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyisemail-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for pyisemail-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d2bebd159f436673219d024a3f02bed1b468c793df9a5fa08d72b7d4b4f6cb4
MD5 afd05d85d66d9f7ebae832fb632dc8d8
BLAKE2b-256 11d2d62d675754a40ec41cd3c28417b6707278de5490d4da1cf7d79da61ebaa1

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