From 1405506db2ad3ffdc19c0f12ebacd1058b18774f Mon Sep 17 00:00:00 2001 From: topilski Date: Tue, 20 Feb 2018 09:02:54 +0300 Subject: [PATCH] Validate email mx --- base/utils.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/base/utils.py b/base/utils.py index e2d1b11..742b661 100644 --- a/base/utils.py +++ b/base/utils.py @@ -7,6 +7,7 @@ import re import shutil import subprocess import tarfile +from validate_email import validate_email from urllib.request import urlopen @@ -34,10 +35,7 @@ class CompileInfo(object): def is_valid_email(email: str) -> bool: - if not re.match('[^@]+@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$', email): - return False - - return True + return validate_email(email, check_mx=True) def is_role_based_email(email: str) -> bool: