此存储库包含一次性和临时电子邮件地址域的列表,通常用于注册虚拟用户,以便发送垃圾邮件或滥用某些服务。
我们不能保证所有这些仍然可以被视为一次性的,但我们会进行基本检查,因此它们很可能在某个时间点是一次性的。
文件allowlist.conf 收集通常被标识为一次性但实际上并非如此的电子邮件域。
请随意创建 PR 并添加内容或请求删除某些域(并说明原因)。
具体来说,请在您的 PR 中引用,其中可以生成使用该域的一次性电子邮件地址,以便维护人员可以验证它。
请以相同的格式将新的一次性域名直接添加到disposable_email_blocklist.conf中(仅换行中不带@的二级域名),然后运行maintain.sh。 shell 脚本将帮助您将大写字母转换为小写字母、排序、删除重复项以及删除列入白名单的域。
您可以复制、修改、分发和使用该作品,甚至可以用于商业目的,而无需征求许可。
2/11/21 我们创建了一个 github 组织帐户并将存储库转移到其中。
2019 年 4 月 18 日 @di 作为该项目的核心维护者加入。谢谢你!
2017 年 7 月 31 日 @deguif 加入作为该项目的核心维护者。谢谢!
2016 年 12 月 6 日 - 感谢 @di,可作为 PyPI 模块使用
2016 年 7 月 27 日 - 将所有域转换为二级。这意味着从这次提交开始,实现者应该注意正确匹配二级域名,即@xxx.yyy.zzz
应该匹配阻止列表中的yyy.zzz
,其中zzz
是公共后缀。更多信息请参见 #46
2014 年 9 月 2 日 - 首次提交 393c21f5
目录:Python、PHP、Go、Ruby on Rails、NodeJS、C#、bash、Java、Swift
with open ( 'disposable_email_blocklist.conf' ) as blocklist :
blocklist_content = { line . rstrip () for line in blocklist . readlines ()}
if email . partition ( '@' )[ 2 ] in blocklist_content :
message = "Please enter your permanent email address."
return ( False , message )
else :
return True
感谢@di,可作为 PyPI 模块使用
>> > from disposable_email_domains import blocklist
>> > 'bearsarefuzzy.com' in blocklist
True
由 @txt3rob、@deguif、@pjebs 和 @Wruczek 贡献
function isDisposableEmail ( $ email , $ blocklist_path = null ) {
if (! $ blocklist_path ) $ blocklist_path = __DIR__ . ' /disposable_email_blocklist.conf ' ;
$ disposable_domains = file ( $ blocklist_path , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
$ domain = mb_strtolower ( explode ( ' @ ' , trim ( $ email ))[ 1 ]);
return in_array ( $ domain , $ disposable_domains );
}
或者查看 Composer 包 https://github.com/elliotjreed/disposable-emails-filter-php。
由@pjebs 贡献
import ( "bufio" ; "os" ; "strings" ;)
var disposableList = make ( map [ string ] struct {}, 3500 )
func init () {
f , _ := os . Open ( "disposable_email_blocklist.conf" )
for scanner := bufio . NewScanner ( f ); scanner . Scan (); {
disposableList [ scanner . Text ()] = struct {}{}
}
f . Close ()
}
func isDisposableEmail ( email string ) ( disposable bool ) {
segs := strings . Split ( email , "@" )
_ , disposable = disposableList [ strings . ToLower ( segs [ len ( segs ) - 1 ])]
return
}
或者查看 Go 包 https://github.com/rocketlaunchr/anti-disposable-email。
由@MitsunChieh 贡献
在资源模型中,通常是user.rb
:
before_validation :reject_email_blocklist
def reject_email_blocklist
blocklist = File . read ( 'config/disposable_email_blocklist.conf' ) . split ( " n " )
if blocklist . include? ( email . split ( '@' ) [ 1 ] )
errors [ :email ] << 'invalid email'
return false
else
return true
end
end
由@boywithkeyboard 贡献
import { readFile } from 'node:fs/promises'
let blocklist
async function isDisposable ( email ) {
if ( ! blocklist ) {
const content = await readFile ( 'disposable_email_blocklist.conf' , { encoding : 'utf-8' } )
blocklist = content . split ( 'rn' ) . slice ( 0 , - 1 )
}
return blocklist . includes ( email . split ( '@' ) [ 1 ] )
}
或者查看 NPM 包 https://github.com/mziyut/disposable-email-domains-js。
private static readonly Lazy < HashSet < string > > _emailBlockList = new Lazy < HashSet < string > > ( ( ) =>
{
var lines = File . ReadLines ( " disposable_email_blocklist.conf " )
. Where ( line => ! string . IsNullOrWhiteSpace ( line ) && ! line . TrimStart ( ) . StartsWith ( " // " ) ) ;
return new HashSet < string > ( lines , StringComparer . OrdinalIgnoreCase ) ;
} ) ;
private static bool IsBlocklisted ( string domain ) => _emailBlockList . Value . Contains ( domain ) ;
.. .
var addr = new MailAddress ( email ) ;
if ( IsBlocklisted ( addr . Host ) ) )
throw new ApplicationException ( " Email is blocklisted. " ) ;
#!/bin/bash
# This script checks if an email address is temporary.
# Read blocklist file into a bash array
mapfile -t blocklist < disposable_email_blocklist.conf
# Check if email domain is in blocklist
if [[ " ${blocklist[@]} " =~ " ${email#*@} " ]]; then
message="Please enter your permanent email address."
return_value=false
else
return_value=true
fi
# Return result
echo "$return_value"
代码假定您已在类旁边添加了disposable_email_blocklist.conf
作为类路径资源。
private static final Set < String > DISPOSABLE_EMAIL_DOMAINS ;
static {
Set < String > domains = new HashSet <>();
try ( BufferedReader in = new BufferedReader (
new InputStreamReader (
EMailChecker . class . getResourceAsStream ( "disposable_email_blocklist.conf" ), StandardCharsets . UTF_8 ))) {
String line ;
while (( line = in . readLine ()) != null ) {
line = line . trim ();
if ( line . isEmpty ()) {
continue ;
}
domains . add ( line );
}
} catch ( IOException ex ) {
LOG . error ( "Failed to load list of disposable email domains." , ex );
}
DISPOSABLE_EMAIL_DOMAINS = domains ;
}
public static boolean isDisposable ( String email ) throws AddressException {
InternetAddress contact = new InternetAddress ( email );
return isDisposable ( contact );
}
public static boolean isDisposable ( InternetAddress contact ) throws AddressException {
String address = contact . getAddress ();
int domainSep = address . indexOf ( '@' );
String domain = ( domainSep >= 0 ) ? address . substring ( domainSep + 1 ) : address ;
return DISPOSABLE_EMAIL_DOMAINS . contains ( domain );
}
由@1998code 贡献
func checkBlockList ( email : String , completion : @escaping ( Bool ) -> Void ) {
let url = URL ( string : " https://raw.githubusercontent.com/disposable-email-domains/disposable-email-domains/master/disposable_email_blocklist.conf " ) !
let task = URLSession . shared . dataTask ( with : url ) { data , response , error in
if let data = data {
if let string = String ( data : data , encoding : . utf8 ) {
let lines = string . components ( separatedBy : " n " )
for line in lines {
if email . contains ( line ) {
completion ( true )
return
}
}
}
}
completion ( false )
}
task . resume ( )
}