I've put together a small Python snippet called DIY Email MX Validator. Its purpose is straightforward: to check if an email address is formatted correctly and if the domain associated with it has MX (Mail Exchanger) records set up.
This tool is for developers who need to perform basic deliverability checks on email addresses. If you're building an application and want to avoid signing up for expensive third-party email validation services for simple checks like these, this snippet can be a useful alternative. It's designed to be self-hosted and free to use.
It performs two main checks:
- Format Validation: Ensures the email address adheres to standard formatting rules (e.g., contains '@', has a domain part).
- MX Record Verification: Queries DNS for MX records of the email's domain. The presence of MX records indicates that the domain is configured to receive emails.
This is not a comprehensive email verification tool that checks if the mailbox itself exists or is active. It focuses solely on the structural validity of the email address and the domain's mail server configuration.
If you need a simple, programmatic way to perform these basic checks without external dependencies or recurring costs, this Python snippet might be what you're looking for.
Get it here: DIY Email MX Validator (Python)
Top comments (0)