def process_email(email):
"""Validates that the email is valid.
Return email ascii encoded if valid, None if not.
"""
if not email:
return None
email = force_unicode(email)
try:
# NOTE SFDC doesn't support SMPTUTF8, so we cannot enable support
# here until they do or we switch providers
info = validate_email(email, allow_smtputf8=False,
check_deliverability=False)
except EmailNotValidError:
return None
return info.get('email_ascii', None)
评论列表
文章目录