I want to verify a large number of emails addresses using Python. I was wondering what would be the best way of doing so. I've looked at the SMTP and the Validate Email library but I haven't been able to get either working.
For the SMTP library I couldn't figure out how to setup an SMTP server(I tried using Gmail's but it didn't work) and for the Validate Email it was giving me "None" to ANY email address I tried.
Validate Email library code:
from validate_email import validate_email
is_valid = validate_email(EMAIL ADDRESS,verify=True)
I always got back "None" from the code above.
SMPT library code:
import smtplib
server = smtplib.SMTP()
server.connect()
When I used server = smtplib.SMTP('smtp.gmail.com',587)
I got:
(252, "2.1.5 Send some mail, I'll try my best or1sm11343445igb.4 - gsmtp")
No matter what email I put in server.verify(email)
.
EDIT 1: Many of the answers only check the form of an email address instead of whether or not the email address is actually valid!