-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmailSlicer.py
More file actions
32 lines (25 loc) · 1.05 KB
/
EmailSlicer.py
File metadata and controls
32 lines (25 loc) · 1.05 KB
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
32
import dns.resolver
from validate_email_address import validate_email
def email_slicer(email):
try:
is_valid = validate_email(email, verify=False)
if is_valid:
username, domain = email.split('@')
mx_records = dns.resolver.resolve(domain, 'MX')
print(f"Username: {username}\nDomain: {domain}")
print(f"MX Records: {[str(record.exchange) for record in mx_records]}")
else:
choice = input("Invalid Email Address\nDo you want to continue (y for yes and n for no)? ").lower()
if choice == "y":
user_email = input("Enter a valid email address: ")
email_slicer(user_email)
else:
print("Thank you for using Email Slicer")
quit()
except ValueError:
print("Invalid email address")
except dns.resolver.NXDOMAIN:
print(f"The domain does not exist")
user_email = input("Enter your email address: ")
# Call the email_slicer function with the provided email
email_slicer(user_email)