Created
June 11, 2022 17:13
-
-
Save Dheirya/7d7214c8449afb366b169a2a1ba4e5e5 to your computer and use it in GitHub Desktop.
Python Spam Email Validator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
def is_disposable_email(email: str) -> bool: | |
e = email.split('@')[-1] | |
for ln in urllib.request.urlopen("https://disposable.github.io/disposable-email-domains/domains.txt"): | |
if ln.decode('utf-8').strip() == e: | |
return True | |
return False | |
print(is_disposable_email("[email protected]")) # True | |
print(is_disposable_email("[email protected]")) # False | |
print(is_disposable_email("[email protected]")) # False | |
print(is_disposable_email("[email protected]")) # True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment