Email Config Checker is a Python script that checks the DNS records for a list of email accounts. The script checks the MX record, SPF record, and DKIM record for each email account and tests the SMTP connection to the MX hostname.
- Python 3.x
dnspython
library (pip install dnspython
)
- Clone or download the repository to your local machine.
- Rename
config.ini.example
toconfig.ini
. - Open the
config.ini
file and customize the configuration settings as needed. - Run the script by typing
python dns_checker.py
in the command line.
The script will loop through the email accounts in the email_accounts
configuration and print out the DNS records and SMTP test results for each email account.
Checking email address john@example.com
MX records for domain example.com: ['mx.example.com.cust.a.hostedemail.com.']
SPF record for domain example.com: "v=spf1 include:_spf.hostedemail.com ~all"
DKIM record for email john@example.com: "v=DKIM1;t=s;p=exampleaYCaVwFGAdnQIhDAQAB"
Email address john@example.com is working
Checking email address sarah@example.com
MX records for domain example.com: ['mx.example.com.cust.a.hostedemail.com.']
SPF record for domain example.com: "v=spf1 include:_spf.hostedemail.com ~all"
DKIM record for email sarah@example.com: "v=DKIM1;t=s;p=exampleaYCaVwFGAdnQIhDAQAB"
Email address sarah@example.com is working
Total number of failures: 0
The config.ini
file contains the following configurations:
email_accounts
: A list of email accounts to check, separated by a newline.
nameservers
: A comma-separated list of DNS servers to use for DNS resolution.timeout
: The DNS resolver timeout in seconds.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to contact me on Twitter, DEV Community or LinkedIn if you have any questions or suggestions.
Or just visit my website to see what I do.