We cannot guarantee all of these can still be considered disposable but we do basic checking so chances are they were disposable at one point in time.
One of the most impactful mechanisms we currently have is prohibiting known “throw-away” email domains from creating accounts on the index. We currently use the disposable-email-domains list as well as our own internal list to block registration with -or association of - such domains for PyPI accounts.
– Ee Durbin, PyPI Admin, Director of Infrastructure (PSF) link
Allowlist
The file allowlist.conf gathers email domains that are often identified as disposable but in fact are not.
Contributing
Feel free to create PR with additions or request removal of some domain (with reasons).
Specifically, please cite in your PR where one can generate a disposable email address which uses that domain, so the maintainers can verify it.
Please add new disposable domains directly into disposable_email_blocklist.conf in the same format (only second level domains on new line without @), then run maintain.sh. The shell script will help you convert uppercase to lowercase, sort, remove duplicates and remove allowlisted domains.
License
You can copy, modify, distribute and use the work, even for commercial purposes, all without asking permission.
Changelog
1/9/25 Enabled GitHub sponsorhip for this work. Everybody can do it, but currently only one person does it. Send them $2 for a coffee if you care.
2/11/21 We created a github org account and transferred the repository to it.
4/18/19 @dijoined as a core maintainer of this project. Thank you!
7/31/17 @deguifjoined as a core maintainer of this project. Thanks!
7/27/16 - Converted all domains to the second level. This means that starting from this commit the implementers should take care of matching the second level domain names properly i.e. @xxx.yyy.zzz should match yyy.zzz in blocklist where zzz is a public suffix. More info in #46
withopen('disposable_email_blocklist.conf')asblocklist:blocklist_content={line.rstrip()forlineinblocklist.readlines()}ifemail.partition('@')[2]inblocklist_content:message="Please enter your permanent email address."return(False,message)else:returnTrue
privatestaticreadonlyLazy<HashSet<string>>_emailBlockList=newLazy<HashSet<string>>(()=>{varlines=File.ReadLines("disposable_email_blocklist.conf").Where(line=>!string.IsNullOrWhiteSpace(line)&&!line.TrimStart().StartsWith("//"));returnnewHashSet<string>(lines,StringComparer.OrdinalIgnoreCase);});privatestaticboolIsBlocklisted(stringdomain)=>_emailBlockList.Value.Contains(domain);...varaddr=newMailAddress(email);if(IsBlocklisted(addr.Host)))thrownewApplicationException("Email is blocklisted.");
Bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# This script checks if an email address is temporary.# Read blocklist file into a bash arraymapfile -t blocklist < disposable_email_blocklist.conf
# Check if email domain is in blocklistif[[" ${blocklist[@]} "=~ " ${email#*@} "]];thenmessage="Please enter your permanent email address."return_value=falseelsereturn_value=truefi# Return resultecho"$return_value"
Java
Code assumes that you have added disposable_email_blocklist.conf next to your class as classpath resource.
privatestaticfinalSet<String>DISPOSABLE_EMAIL_DOMAINS;static{Set<String>domains=newHashSet<>();try(BufferedReaderin=newBufferedReader(newInputStreamReader(EMailChecker.class.getResourceAsStream("disposable_email_blocklist.conf"),StandardCharsets.UTF_8))){Stringline;while((line=in.readLine())!=null){line=line.trim();if(line.isEmpty()){continue;}domains.add(line);}}catch(IOExceptionex){LOG.error("Failed to load list of disposable email domains.",ex);}DISPOSABLE_EMAIL_DOMAINS=domains;}publicstaticbooleanisDisposable(Stringemail)throwsAddressException{InternetAddresscontact=newInternetAddress(email);returnisDisposable(contact);}publicstaticbooleanisDisposable(InternetAddresscontact)throwsAddressException{Stringaddress=contact.getAddress();intdomainSep=address.indexOf('@');Stringdomain=(domainSep>=0)?address.substring(domainSep+1):address;returnDISPOSABLE_EMAIL_DOMAINS.contains(domain);}