mail icon indicating copy to clipboard operation
mail copied to clipboard

`Mail::AddressList.new` fails to parse RFC822 A.1.5

Open entretechno-jeremiah opened this issue 3 years ago • 2 comments

Mail::AddressList.new fails to parse the example given in RFC822 A.1.5:

Mail::AddressList.new(<<~ADDRESS_LIST.chomp)
  Gourmets:  Pompous Person <WhoZiWhatZit@Cordon-Bleu>,
             [email protected], Galloping Gourmet@
             ANT.Down-Under (Australian National Television),
             Cheapie@Discount-Liquors;,
    Cruisers:  Port@Portugal, Jones@SEA;,
      [email protected]
ADDRESS_LIST
# Mail::AddressList can not parse |Gourmets:  Pompous Person <WhoZiWhatZit@Cordon-Bleu>, (Mail::Field::IncompleteParseError)
#            [email protected], Galloping Gourmet@
#            ANT.Down-Under (Australian National Television),
#            Cheapie@Discount-Liquors;,
#   Cruisers:  Port@Portugal, Jones@SEA;,
#     [email protected]|: Only able to parse up to "Gourmets:  Pompous Person <WhoZiWhatZit@Cordon-Bleu>,"

entretechno-jeremiah avatar Apr 13 '22 21:04 entretechno-jeremiah

Have also run into this issue and it seems to occur when attempting to parse addresses with spaces in the name:

expect(email).to deliver_from("John's 1 Doe's [email protected]")

# Mail::AddressList can not parse |John's 1 Doe's [email protected]|: Only 
able to parse up to "John's 1 Doe's [email protected]"

jrevon1 avatar Feb 10 '23 18:02 jrevon1

I think the example John's 1 Doe's [email protected] is invalid. Spaces are not allowed in the local-part unless it is quoted. It should be "John's 1 Doe's 1-unique-token-identifier"@domain.com

sebbASF avatar Feb 10 '23 22:02 sebbASF