Queries MXToolBox and checks DKIM, DMARC, and SPF records for a given domain.
Automatically finds all selectors for a domain, unless specified which selectors to check.
This repo can be installed by downloading the zip file here or by cloning the repository:
git clone https://github.com/TaranYourAss/email_check.git
This script relies on the curl_cffi library: https://github.com/yifeikong/curl_cffi
You can install all depenencies via:
pip install -r requirements.txt
Example:
This will run all checks against the Twitch domain with only the "google" DKIM selector being checked for DKIM failures, and then print verbose details.
python3 email_check.py -v -d twitch.tv -s google
If you do not know what selectors a domain uses, you can just input the domain and the script will automatically find all selectors for that domain.
python3 email_check.py -d twitch.tv
[*] Running DMARC, DKIM, and SPF checks for twitch.tv...
[*] Found 7 DKIM selectors for twitch.tv:
- google - zendesk2
- s1 - mandrill
- s2 - k1
- zendesk1
[*] DKIM Check: PASS
[*] SPF Check: FAIL
[*] DMARC Check: PASS
Using the -v flag can show you exactly why a check failed:
[*] SPF Check: FAIL
Record Content: v=spf1 include:_spf.google.com include:amazonses.com include:spf.mtasv.net include:mail.zendesk.com include:_spf.twitch.tv include:aspmx.pardot.com a mx -all
Failed:
* SPF Included Lookups - Too many included lookups (12)
- https://mxtoolbox.com/Problem/spf/SPF-Included-Lookups?page=prob_spf&showlogin=1&hidetoc=1&action=spf:twitch.tv