Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config/initializers/truemail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# By default verifier domain based on verifier email
# config.verifier_domain = 'internet.ee'

config.email_pattern = /\A(?=[\p{L}0-9!#$%&'*+\/=?^_{|}~-]*[\p{L}0-9])([\p{L}0-9!#$%&'*+\/=?^_{|}~-]+(?:\.[\p{L}0-9!#$%&'*+\/=?^_{|}~-]+)*)@(?i:(xn--)?(?:[\p{L}0-9][\p{L}0-9-]{0,61}[\p{L}0-9]\.)+[\p{L}]{2,63}|\[[\d.a-fA-F:]+\])\z/
# Host labels may be 1 char (smth@e.ee, smth@a.domain.ee); TLD stays 2+ letters.
config.email_pattern = /\A(?=[\p{L}0-9!#$%&'*+\/=?^_{|}~-]*[\p{L}0-9])([\p{L}0-9!#$%&'*+\/=?^_{|}~-]+(?:\.[\p{L}0-9!#$%&'*+\/=?^_{|}~-]+)*)@(?i:(xn--)?(?:[\p{L}0-9](?:[\p{L}0-9-]{0,61}[\p{L}0-9])?\.)+[\p{L}]{2,63}|\[[\d.a-fA-F:]+\])\z/

# config.smtp_error_body_pattern = /regex_pattern/

Expand Down
10 changes: 9 additions & 1 deletion test/interactions/email_check_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def test_validates_regex_email_format
'hello.world@example.com',
'_user.email@domain.com',
'__user.email@domain.com',
'smth@e.ee',
'smth@a.domain.ee',
'smth@sub.b.domain.ee',
'smth@1.ee',
]

valid_emails.each_with_index do |email, index|
Expand All @@ -29,7 +33,11 @@ def test_validates_regex_email_format
'user.@domain.com',
'us"er@domain.com',
'user@domain..com',
'~@internet.ee'
'~@internet.ee',
'smth@domain.e',
'smth@a.domain.e',
'smth@-.ee',
'smth@a-.ee'
]

invalid_emails.each do |email|
Expand Down
Loading