Skip to main content

Validate Your Email

Project description

Robust Email Validator

RobustEmailValidator is a flexible and powerful Python library for validating email addresses. It verifies email syntax, checks for disposable domains, and validates domain MX records to ensure email deliverability.

Features

  • Email Syntax Validation: Checks if an email address follows proper syntax.
  • Bulk Email Validation: Validate multiple emails at once.
  • Disposable Email Detection: Identifies if an email address belongs to a disposable service.
  • MX Record Verification: Checks if the email domain has valid MX (Mail Exchange) records.

Installation

Prerequisites

Ensure you have the following installed:

  • Python 3.7 or higher
  • pip for dependency management

Installing via pip

  1. Clone this repository to your local machine:

    git clone https://github.com/tinapyp/robust-email-validator.git
    cd robust-email-validator
    
  2. Install the library and its dependencies:

    pip install .
    

    Alternatively, once published on PyPI:

    pip install robust-email-validator
    

Usage

The library is easy to integrate into any Python project.

Validating a Single Email

from robust_email_validator import validated_email

email = "test@example.com"
result = validated_email(email)
print(f"Is {email} valid? {result.is_valid}")

Checking if Email Domain is Disposable

from robust_email_validator import check_email_disposable

email = "test@tempmail.com"
result = check_email_disposable(email)
print(f"Is {email} disposable? {'Yes' if not result.is_valid else 'No'}")

Checking if Email Domain Has MX Records

from robust_email_validator import check_email_mx

email = "test@example.com"
result = check_email_mx(email)
print(f"Does {email} have MX records? {'Yes' if result.is_valid else 'No'}")

Configuration

The library allows configuration of the disposable domain list source. In config.py, set the URL to fetch a disposable domain list as needed:

# config.py
DISPOSABLE_URL = "https://someapi.com/disposable-domains"

Development

To contribute:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-branch.
  3. Implement your changes and write tests.
  4. Run tests to ensure functionality: pytest.
  5. Submit a pull request with a summary of your changes.

Running Tests

To run tests, install pytest if needed:

pip install pytest

Then run:

pytest test/test_email_validator.py

License

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

Acknowledgements

  • dnspython for DNS query handling.
  • requests for HTTP requests to retrieve disposable domains.

Contributions and feedback are welcome! Open an issue or submit a pull request if you’d like to get involved.

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

robust_email_validator-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

robust_email_validator-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file robust_email_validator-0.1.0.tar.gz.

File metadata

File hashes

Hashes for robust_email_validator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a31263798b60be2a0530b4332193e29dfc526383380f820dd1c587c263f8d304
MD5 25fdc65438c48486356ea4db6ced1fb9
BLAKE2b-256 d286388ebb4560a8311bb65cb7625c2d95c9e7535fe27fc9d3116c8a16910b8c

See more details on using hashes here.

File details

Details for the file robust_email_validator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robust_email_validator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c62baf9a5127781a8c5e0a759c1370519a0dbb5028fd4a15bc4f04d790f6a9b
MD5 32f031f297c9a2794b479969180189b4
BLAKE2b-256 897337f9b51f0b2bfb880df12f10e2ffd564f11dbd0a88d94abc72929547af32

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