forked from micke/valid_email2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull_mailchecker_emails.rb
More file actions
28 lines (20 loc) · 908 Bytes
/
pull_mailchecker_emails.rb
File metadata and controls
28 lines (20 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env ruby
require "yaml"
require "json"
require "net/http"
whitelisted_emails = %w(
onet.pl poczta.onet.pl fastmail.fm hushmail.com
hush.ai hush.com hushmail.me naver.com qq.com example.com
yandex.net gmx.com gmx.es webdesignspecialist.com.au vp.com
onit.com asics.com freemail.hu 139.com mail2world.com
)
existing_emails = File.open("config/disposable_email_domains.txt") { |f| f.read.split("\n") }
remote_emails = [
"https://raw.githubusercontent.com/FGRibreau/mailchecker/master/list.txt",
"https://raw.githubusercontent.com/disposable/disposable-email-domains/master/domains.txt",
].flat_map do |url|
resp = Net::HTTP.get_response(URI.parse(url))
resp.body.split("\n").flatten
end
result_emails = (existing_emails + remote_emails).map(&:strip).uniq.sort - whitelisted_emails
File.open("config/disposable_email_domains.txt", "w") { |f| f.write result_emails.join("\n") }