Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ Check if the host has SMTP Server and the email really exists::
from validate_email import validate_email
is_valid = validate_email('[email protected]',verify=True)

Verify email exists on a server that implements callback verfication
-------------------

Check if the host has SMTP Server and the email really exists::

from validate_email import validate_email
is_valid = validate_email('[email protected]',verify=True,sending_email="[email protected]")

[email protected] must be a valid e-mail that you control.

For information on callback verification see: https://en.wikipedia.org/wiki/Callback_verification

TODOs and BUGS
==============
Expand Down
5 changes: 3 additions & 2 deletions validate_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def get_mx_ip(hostname):
return MX_DNS_CACHE[hostname]


def validate_email(email, check_mx=False, verify=False, debug=False, smtp_timeout=10):
def validate_email(email, check_mx=False, verify=False, debug=False,\
sending_email='', smtp_timeout=10):
"""Indicate whether the given string is a valid email address
according to the 'addr-spec' portion of RFC 2822 (see section
3.4.1). Parts of the spec that are marked obsolete are *not*
Expand Down Expand Up @@ -153,7 +154,7 @@ def validate_email(email, check_mx=False, verify=False, debug=False, smtp_timeou
if debug:
logger.debug(u'%s answer: %s - %s', mx[1], status, _)
continue
smtp.mail('')
smtp.mail(sending_email)
status, _ = smtp.rcpt(email)
if status == 250:
smtp.quit()
Expand Down