Skip to content

Instantly share code, notes, and snippets.

@Dheirya
Created June 11, 2022 17:13
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Dheirya/7d7214c8449afb366b169a2a1ba4e5e5 to your computer and use it in GitHub Desktop.
Python Spam Email Validator
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("voporej391@nzaif.com")) # True
print(is_disposable_email("random_real@gmail.com")) # False
print(is_disposable_email("mail@socialrumbles.com")) # False
print(is_disposable_email("fiqyqo@fxcoral.biz")) # True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment