For user input formatted like Mail::Address.new("someone@(comment)net") or Mail::Address.new("someone@(comment).net"), Mail::Address will emit an ArgumentError (bad value for range):
> Mail::Address.new("someone@(comment)net")
Traceback (most recent call last):
7: from /Users/ticky/.rbenv/versions/2.5.0/bin/irb:11:in `<main>'
6: from (irb):16
5: from (irb):16:in `new'
4: from /Users/ticky/.rbenv/gems/2.5.0/gems/mail-2.7.0/lib/mail/elements/address.rb:30:in `initialize'
3: from /Users/ticky/.rbenv/gems/2.5.0/gems/mail-2.7.0/lib/mail/elements/address.rb:192:in `parse'
2: from /Users/ticky/.rbenv/gems/2.5.0/gems/mail-2.7.0/lib/mail/parsers/address_lists_parser.rb:32930:in `parse'
1: from /Users/ticky/.rbenv/gems/2.5.0/gems/mail-2.7.0/lib/mail/parser_tools.rb:9:in `chars'
ArgumentError (bad value for range)
This appears to be because it tries to find the string indexes of the domain part, and fails to do so. This should probably emit a more useful Mail-specific error.
For user input formatted like
Mail::Address.new("someone@(comment)net")
orMail::Address.new("someone@(comment).net")
,Mail::Address
will emit anArgumentError (bad value for range)
:This appears to be because it tries to find the string indexes of the domain part, and fails to do so. This should probably emit a more useful
Mail
-specific error.Tested on Ruby 2.5.0 with mail 2.7.0