Skip to main content

A powerful email validation tool using DNS and SMTP checks

Project description

EmailSherlock 🕵️‍♂️📧

EmailSherlock is a powerful Python tool for validating email addresses using DNS and SMTP checks. It provides a confidence score for each email's validity and potential deliverability, helping you deduce the legitimacy of email addresses with detective-like precision.

PyPI version License: MIT Python Versions

🔍 Features

  • Validates email format using regex
  • Checks domain DNS records (MX and A records)
  • Attempts SMTP connection to verify mail server responsiveness
  • Provides a confidence score (0-100%) for each email
  • Handles both single email validation and bulk validation from a file
  • Multi-threaded for improved performance with large datasets
  • Cleaner error messages without unnecessary instructions
  • Default output file for bulk validation
  • Multiple MX record support
  • Improved SMTP connection attempts across various ports and protocols
  • Random sender email generation for each SMTP check

🛠️ Installation

You can install EmailSherlock using pip:

pip install emailsherlock

Alternatively, you can clone the repository and install it manually:

git clone https://github.com/yourusername/emailsherlock.git
cd emailsherlock
pip install -e .

🚀 Usage

Command Line Interface

Single Email Validation

To validate a single email address:

emailsherlock --single email@example.com

Bulk Email Validation from File

To validate multiple email addresses from a file:

emailsherlock --file input_file.txt

This will read from input_file.txt and write results to results.csv (default output file).

To specify both input and output files:

emailsherlock --file input_file.txt --output custom_output.csv

The input file should contain one email address per line. If you want to include additional information (like a school name), use a comma to separate it from the email:

email1@example.com
email2@example.com
School Name,email3@example.com

Python API

You can also use EmailSherlock in your Python scripts:

from emailsherlock import EmailSherlock

sherlock = EmailSherlock()

# Validate a single email
result = sherlock.validate_email("email@example.com")
print(result)

# Validate multiple emails
emails = ["email1@example.com", "email2@example.com"]
results = sherlock.validate_emails(emails)
for result in results:
    print(result)

📊 Output

The script will generate a CSV file with the following columns:

  • Email
  • School (if provided in the input)
  • Valid (True/False)
  • Confidence Score (0-100%)
  • Notes

Additionally, a disclaimer about the limitations of email validation will be included at the top of the output file.

💯 Confidence Score Explanation

  • 100%: Valid format, DNS records, MX records, and responsive SMTP server
  • 75%: Valid format, DNS records, and MX records, but unresponsive SMTP server
  • 50%: Valid format and DNS records, but no MX records
  • 25%: Valid format and DNS records, but no MX records and unresponsive SMTP server
  • 0%: Invalid format, no valid DNS records, or explicitly rejected by SMTP server

⚠️ Limitations

EmailSherlock provides an estimate of email validity based on DNS and SMTP checks. However, it cannot guarantee that an email address is actually in use or will successfully receive emails. The only way to be certain is to send an actual email and confirm receipt.

🔮 Future Enhancements

  • Implement rate limiting to avoid overwhelming email servers or getting blocked
  • Add a delay between validation attempts for the same domain to reduce the load on email servers
  • Implement a caching mechanism for DNS and SMTP results to speed up validation for repeated domains
  • Add more sophisticated patterns for email format validation, such as checking for common typos or invalid TLDs

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📜 License

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

💖 Support the Project

If you find EmailSherlock useful, you can buy me a coffee:

Buy Me A Coffee

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

emailsherlock-0.4.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

emailsherlock-0.4.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file emailsherlock-0.4.0.tar.gz.

File metadata

  • Download URL: emailsherlock-0.4.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for emailsherlock-0.4.0.tar.gz
Algorithm Hash digest
SHA256 33c252eebf69ec5f8807355058a1eccca4b1f5363b3612e4f538d26ec28a5b96
MD5 e614e1bfc90d306d9d20ba8b2860d945
BLAKE2b-256 99f3ad0e56b659d2fabee71c5fa8b6b0cea0822e29e2b1dbd26c9f9eee1c59b9

See more details on using hashes here.

File details

Details for the file emailsherlock-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: emailsherlock-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for emailsherlock-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da5cb9f0c5b198371e8f5ee26c1b06ca6be3b59f1adeaa0145b31993a67bf115
MD5 9eabcd5d0cceabe66595b031d9351510
BLAKE2b-256 8c5a4eebcd259faa59b6d4528f1bbf1a9ad0d19de71229e0828412a057b8e879

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