Skip to content

Commit 7497bda

Browse files
committed
Normalize fastmail alias subdomains
1 parent 6c43d63 commit 7497bda

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
* Periods are now removed from `gmail.com` email address local parts when
88
`hash_address` is used. For example, `[email protected]` will become
99
10+
* Fastmail alias subdomain email addresses are now normalized when
11+
`hash_address` is used. For example, `[email protected]` will
12+
1013

1114
## v2.4.0 (2024-01-12)
1215

lib/minfraud/components/email.rb

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ def clean_email_address(address)
100100
local_part.gsub!('.', '')
101101
end
102102

103+
domain_parts = domain.split('.')
104+
if domain_parts.length > 2
105+
possible_domain = domain_parts[1..].join('.')
106+
if FASTMAIL_DOMAINS.key?(possible_domain)
107+
domain = possible_domain
108+
if local_part != ''
109+
local_part = domain_parts[0]
110+
end
111+
end
112+
end
113+
103114
"#{local_part}@#{domain}"
104115
end
105116

@@ -129,6 +140,127 @@ def clean_email_address(address)
129140
}.freeze
130141
private_constant :EQUIVALENT_DOMAINS
131142

143+
FASTMAIL_DOMAINS = {
144+
'123mail.org' => true,
145+
'150mail.com' => true,
146+
'150ml.com' => true,
147+
'16mail.com' => true,
148+
'2-mail.com' => true,
149+
'4email.net' => true,
150+
'50mail.com' => true,
151+
'airpost.net' => true,
152+
'allmail.net' => true,
153+
'bestmail.us' => true,
154+
'cluemail.com' => true,
155+
'elitemail.org' => true,
156+
'emailcorner.net' => true,
157+
'emailengine.net' => true,
158+
'emailengine.org' => true,
159+
'emailgroups.net' => true,
160+
'emailplus.org' => true,
161+
'emailuser.net' => true,
162+
'eml.cc' => true,
163+
'f-m.fm' => true,
164+
'fast-email.com' => true,
165+
'fast-mail.org' => true,
166+
'fastem.com' => true,
167+
'fastemail.us' => true,
168+
'fastemailer.com' => true,
169+
'fastest.cc' => true,
170+
'fastimap.com' => true,
171+
'fastmail.cn' => true,
172+
'fastmail.co.uk' => true,
173+
'fastmail.com' => true,
174+
'fastmail.com.au' => true,
175+
'fastmail.de' => true,
176+
'fastmail.es' => true,
177+
'fastmail.fm' => true,
178+
'fastmail.fr' => true,
179+
'fastmail.im' => true,
180+
'fastmail.in' => true,
181+
'fastmail.jp' => true,
182+
'fastmail.mx' => true,
183+
'fastmail.net' => true,
184+
'fastmail.nl' => true,
185+
'fastmail.org' => true,
186+
'fastmail.se' => true,
187+
'fastmail.to' => true,
188+
'fastmail.tw' => true,
189+
'fastmail.uk' => true,
190+
'fastmail.us' => true,
191+
'fastmailbox.net' => true,
192+
'fastmessaging.com' => true,
193+
'fea.st' => true,
194+
'fmail.co.uk' => true,
195+
'fmailbox.com' => true,
196+
'fmgirl.com' => true,
197+
'fmguy.com' => true,
198+
'ftml.net' => true,
199+
'h-mail.us' => true,
200+
'hailmail.net' => true,
201+
'imap-mail.com' => true,
202+
'imap.cc' => true,
203+
'imapmail.org' => true,
204+
'inoutbox.com' => true,
205+
'internet-e-mail.com' => true,
206+
'internet-mail.org' => true,
207+
'internetemails.net' => true,
208+
'internetmailing.net' => true,
209+
'jetemail.net' => true,
210+
'justemail.net' => true,
211+
'letterboxes.org' => true,
212+
'mail-central.com' => true,
213+
'mail-page.com' => true,
214+
'mailandftp.com' => true,
215+
'mailas.com' => true,
216+
'mailbolt.com' => true,
217+
'mailc.net' => true,
218+
'mailcan.com' => true,
219+
'mailforce.net' => true,
220+
'mailftp.com' => true,
221+
'mailhaven.com' => true,
222+
'mailingaddress.org' => true,
223+
'mailite.com' => true,
224+
'mailmight.com' => true,
225+
'mailnew.com' => true,
226+
'mailsent.net' => true,
227+
'mailservice.ms' => true,
228+
'mailup.net' => true,
229+
'mailworks.org' => true,
230+
'ml1.net' => true,
231+
'mm.st' => true,
232+
'myfastmail.com' => true,
233+
'mymacmail.com' => true,
234+
'nospammail.net' => true,
235+
'ownmail.net' => true,
236+
'petml.com' => true,
237+
'postinbox.com' => true,
238+
'postpro.net' => true,
239+
'proinbox.com' => true,
240+
'promessage.com' => true,
241+
'realemail.net' => true,
242+
'reallyfast.biz' => true,
243+
'reallyfast.info' => true,
244+
'rushpost.com' => true,
245+
'sent.as' => true,
246+
'sent.at' => true,
247+
'sent.com' => true,
248+
'speedpost.net' => true,
249+
'speedymail.org' => true,
250+
'ssl-mail.com' => true,
251+
'swift-mail.com' => true,
252+
'the-fastest.net' => true,
253+
'the-quickest.com' => true,
254+
'theinternetemail.com' => true,
255+
'veryfast.biz' => true,
256+
'veryspeedy.net' => true,
257+
'warpmail.net' => true,
258+
'xsmail.com' => true,
259+
'yepmail.net' => true,
260+
'your-mail.com' => true,
261+
}.freeze
262+
private_constant :FASTMAIL_DOMAINS
263+
132264
def clean_domain(domain)
133265
domain = domain.strip
134266

spec/components/email_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
{ input: 'Test+alias@bücher.com', output: '[email protected]' },
7474
{ input: '[email protected]', output: '[email protected]' },
7575
{ input: '[email protected]', output: '[email protected]' },
76+
{ input: '[email protected]', output: '[email protected]' },
7677
]
7778

7879
tests.each do |i|

0 commit comments

Comments
 (0)