Last active
September 17, 2018 12:22
-
-
Save arjunsinghy96/dbce8193750adcaa50a09c0bbe239e13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from smtplib import SMTP | |
address_to_test = "arjunsinghy96@gmail.com" | |
try: | |
with SMTP('gmail-smtp-in.l.google.com') as smtp: | |
host_exists = True | |
smtp.helo() # send the HELO command | |
smtp.mail('admin@emailgardener.com') # send the MAIL command | |
resp = smtp.rcpt(address_to_test) | |
if resp[0] == 250: # check the status code | |
deliverable = True | |
elif resp[0] == 550: | |
deliverable = False | |
else: | |
print(resp[0]) | |
except smtplib.SMTPServerDisconnected as err: | |
print("SMTP connection error") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment