Skip to content

fabiocaccamo/django-email-validators

Repository files navigation

django-email-validators

no more invalid or disposable emails in your database.

Installation

  • Run pip install django-email-validators
  • Add django_email_validators to settings.INSTALLED_APPS
  • Restart your application server

Usage

Validators

  • ๐Ÿ—‘๏ธ validate_email_non_disposable
  • ๐ŸŒ validate_email_mx
  • โœ๏ธ validate_email_provider_typo

validate_email_non_disposable

Validates that the email is not from a disposable email provider (fast, offline check).

validate_email_mx

Validates that the email domain has valid MX records (slow, requires network access).

validate_email_provider_typo

Validates that the email domain is not a likely typo of a common email provider. Checks a one-character diff against 80+ common providers and verifies the domain has no valid MX records (prevents false positives).

Examples that will be caught:

  • user@gmai.com -> suggests user@gmail.com
  • user@gmail.co -> suggests user@gmail.com
  • user@yahooo.com -> suggests user@yahoo.com

Usage

from django.db import models from django_email_validators import ( validate_email_non_disposable, validate_email_mx, validate_email_provider_typo, ) class User(models.Model): email = models.EmailField( validators=[ validate_email_non_disposable, validate_email_mx, validate_email_provider_typo, ] )

Testing

# clone repository git clone https://github.com/fabiocaccamo/django-email-validators.git && cd django-email-validators # create virtualenv and activate it python -m venv venv && . venv/bin/activate # upgrade pip python -m pip install --upgrade pip # install requirements pip install -r requirements.txt -r requirements-test.txt # install pre-commit to run formatters and linters pre-commit install --install-hooks # run tests tox # or pytest

License

Released under MIT License.


Supporting

See also

  • django-admin-interface - the default admin interface made customizable by the admin itself. popup windows replaced by modals. ๐Ÿง™ โšก

  • django-cache-cleaner - clear the entire cache or individual caches easily using the admin panel or management command. ๐Ÿงน

  • django-colorfield - simple color field for models with a nice color-picker in the admin. ๐ŸŽจ

  • django-extra-settings - config and manage typed extra settings using just the django admin. โš™๏ธ

  • django-maintenance-mode - shows a 503 error page when maintenance-mode is on. ๐Ÿšง ๐Ÿ› ๏ธ

  • django-redirects - redirects with full control. โ†ช๏ธ

  • django-treenode - probably the best abstract model / admin for your tree based stuff. ๐ŸŒณ

  • python-benedict - dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. ๐Ÿ“˜

  • python-codicefiscale - encode/decode Italian fiscal codes - codifica/decodifica del Codice Fiscale. ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ’ณ

  • python-fontbro - friendly font operations. ๐Ÿงข

  • python-fsutil - file-system utilities for lazy devs. ๐ŸงŸโ€โ™‚๏ธ

About

โœ‰๏ธ โœ… no more invalid or disposable emails in your database.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages