此儲存庫包含一次性和臨時電子郵件位址網域的列表,通常用於註冊虛擬用戶,以便發送垃圾郵件或濫用某些服務。
我們不能保證所有這些仍然可以被視為一次性的,但我們會進行基本檢查,因此它們很可能在某個時間點是一次性的。
檔案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 ( )
}