-
Notifications
You must be signed in to change notification settings - Fork 939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mail::Address.new parsing failed when string has a comma #1219
Comments
While having an answer i'm writing the most ugly monkey patch ever:
UPDATE Don't do this, it breaks mail gem. |
This looks like regular address parsing behavior. Commas Mail::Address.new('"Arnold, Roa" <[email protected]>').address
# => "[email protected]"
Mail::Address.new('"Arnold, Roa" <[email protected]>').name
# => "Arnold, Roa" |
Very useful... thanks. However unfortunatelly the address is what I receive from Griddler gem comming from mandrill..
|
I got a similar problem with some incoming mails: Mail::AddressList.new("Doe, John <[email protected]>").addresses.map(&:format)
=> ["Doe", "John <[email protected]>"] so they are split into multiple addresses, although they are meant to be only one. Or even worse like this: Mail::AddressList.new("John Doe, Example INC <[email protected]>")
=> Mail::Field::IncompleteParseError: Mail::AddressList can not parse |John Doe, Example INC <john.doe@example.com>|: Only able to parse up to "John Doe" that will throw exceptions while parsing. I know, the name parts should usually be in quotes to prevent this, but unfortunately we cannot control which mail clients everybody uses and how weird some mail clients format addresses. For the first case I wrote some post-processing code that "stitches" invalid email addresses together again, but in the second case I cannot do much cause of the exception thrown. Any chances that cases like this can be handled by the parser somehow? |
Have the same issue. Did anyone found a workaround? |
Since my previous workaround did not help in the second case I described, I now changed the parser and created a pull request: #1365 |
Are there any plans to merge @Svelix 's solution? |
If the string to be parsed contains a comma in the name it throws the wong email address.
The text was updated successfully, but these errors were encountered: