Skip to main content

Emailfy is a powerful Python package designed for comprehensive email address validation. It goes beyond basic syntax checks, providing advanced validation features and deliverability checks to ensure that email addresses are not only correctly formatted but also deliverable in a real-world environment.

Project description

Emailfy: Validation and Deliverability Checker

License

Emailfy is a Python package designed for comprehensive email address validation and checking the deliverability of email addresses. It goes beyond basic syntax checks, providing advanced validation features and deliverability checks to ensure that email addresses are not only correctly formatted but also deliverable in a real-world environment.

Features

Key Features:

  • Email Validation: Verify if an email address is syntactically correct and adheres to established RFC standards.
  • Internationalization Support: Support for internationalized email addresses, including UTF-8 and IDNA encoding.
  • Deliverability Checks: Ensure the deliverability of email addresses by validating MX records, SPF policies, and domain existence.
  • Customizable Options: Fine-tune validation with customizable settings, including allowing SMTPUTF8, quoted local parts, domain literals, and more.
  • Test Environment Support: Accommodate testing environments where special-use domain names are allowed.

Use Cases:

  • Web Forms: Enhance the user experience by ensuring that entered email addresses are both valid and deliverable.
  • Email Verification Services: Build robust email verification services by seamlessly integrating emailfy for thorough validation.
  • API Endpoints: Secure your applications by validating email addresses before processing user inputs.

Additional Features:

  • Custom Resolver: Configure custom DNS resolvers with adjustable timeouts for deliverability checks.
  • Special Use Domain Handling: Optionally exclude special-use domains from deliverability checks.

Ensure your application's email handling is reliable and secure with emailfy — the ultimate solution for email validation, deliverability checks, and customizable options.

Installation

You can install Emailfy using pip:

pip install emailfy

Usage

  • Basic Email Validation:
from emailfy import validate_email, EmailNotValidError

try:
    validated_email = validate_single_email("user@example.com")
    print("Email is valid:", validated_email.normalized)

except EmailNotValidError as e:
    print("Email is not valid:", str(e))
  • Bulk Email Validation:
from emailfy import validate_email, EmailNotValidError, ValidatedEmail

emails_to_validate = ["user@example.com", "exe@exemplocom"]

try:
    validated_emails = validate_email(emails_to_validate)
    print(validated_emails)

except EmailNotValidError as e:
    print(f"Error details: {e.details}")
    print(f"Full exception: {str(e)}")
  • Custom Resolver Configuration:
from emailfy import caching_resolver, validate_email, EmailNotValidError

# Configure a custom resolver with a longer timeout
custom_resolver = caching_resolver(timeout=20)

try:
    validated_email = validate_email("user@example.com", dns_resolver=custom_resolver)
    print("Email is valid:", validated_email.normalized)

except EmailNotValidError as e:
    print("Email is not valid:", str(e))
  • Using Special Use Domain Names:
from emailfy import SPECIAL_USE_DOMAIN_NAMES, validate_email, EmailNotValidError

try:
    validated_email = validate_email("user@example.com", globally_deliverable=False)
    print("Email is valid:", validated_email.normalized)

except EmailNotValidError as e:
    print("Email is not valid:", str(e))

Configuration

Emailfy provides global attributes that you can adjust:

ALLOW_SMTPUTF8 ALLOW_QUOTED_LOCAL ALLOW_DOMAIN_LITERAL GLOBALLY_DELIVERABLE CHECK_DELIVERABILITY TEST_ENVIRONMENT DEFAULT_TIMEOUT

Refer to the documentation for detailed information on each configuration attribute.

Contributing

If you find a bug, have questions, or want to contribute, please check our contribution guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

emailfy-0.1.6.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

emailfy-0.1.6-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file emailfy-0.1.6.tar.gz.

File metadata

  • Download URL: emailfy-0.1.6.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for emailfy-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7816edf4c2fabf6475034ff8cf24de570716ae9e2aa992ef6f7ffd11553000e8
MD5 added2cf37be422a9be2e6fb40909535
BLAKE2b-256 65942ecd39ace882c21ee55a027bc9a7408c34762f10c9984b3cfa133f347d39

See more details on using hashes here.

File details

Details for the file emailfy-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: emailfy-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for emailfy-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ac096b13a4ea1cf99db89138b86ed1610d9169f5f2240f49f886aab655596774
MD5 454e99f30334abc96d32ad5250865b0c
BLAKE2b-256 54393007d71712cfe8a99f73a1f9d98f7161a7905f2438c477d87c85f576147a

See more details on using hashes here.

Supported by

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