-
Notifications
You must be signed in to change notification settings - Fork 0
/
emailverifier.py
31 lines (22 loc) · 1000 Bytes
/
emailverifier.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import re
class emailVerifier():
def verifyemail(email):
try:
useremail = re.search(r'(.*)@(.*)\.(.*)', email, re.I)
useremailver1 = re.search(useremail.group(1), email, re.I)
removespecialchar = re.compile('[\[{}()\]\\\*]')
a = removespecialchar.sub('', useremail.group(1))
b = removespecialchar.sub('', useremail.group(2))
c = removespecialchar.sub('', useremail.group(3))
if not ((re.match(('[\[{}()\]\\\*]'), email))):
if (len(c) <= 3):
print(email, " is a valid email!")
loop4 = False
return True
else:
print(c, "is and invalid domain extention: it must be three letters or less.")
loop4 = False
return False
except:
print(email, "is not a valid email")
return False