Python How to verify an email address


SUBMITTED BY: alemotta

DATE: March 28, 2017, 8:58 p.m.

FORMAT: Text only

SIZE: 580 Bytes

HITS: 960

  1. Python How to verify an email address
  2. The SMTP protocol includes a command to ask a server whether an address is valid.
  3. Usually VRFY is disabled to prevent spammers from finding legitimate email
  4. addresses,but if it is enabled you can ask the server about an address and
  5. receive a status code indicating validity along with the user’s full name.
  6. import smtplib
  7. server = smtplib.SMTP('mail')
  8. server.set_debuglevel(True) # show communication with the server
  9. try:
  10. userVerif = server.verify('dhellmann')
  11. finally:
  12. server.quit()
  13. print 'User:', userVerif

comments powered by Disqus