You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's how we're retrieving email objects from AWS S3 and then using the mail gem to parse them:
s3_object = Aws::S3::Client.new.get_object(bucket: bucket_name, key: s3_object_key)
mail = Mail.read_from_string(s3_object.body.read)
Here's an anonymized copy of a CC mail header we encountered this week:
#<Mail::Field 0x441b0 @name="Cc" @unparsed_value="Umi Anon <umi_anon@somecompany.com>, Allison Who\r\n\t<allison_who@somecompany.com>, \"gabby.where@other.com.\"\r\n\t<gabby.where@other.com.>" @charset="UTF-8" @field=#<Mail::UnstructuredField:0x00007f029fbbda48 @errors=[["Cc", "Umi Anon <umi_anon@somecompany.com>, Allison Who\r\n\t<allison_who@somecompany.com>, \"gabby.where@other.com.\"\r\n\t<gabby.where@other.com.>", #<Mail::Field::IncompleteParseError: Mail::AddressList can not parse |Umi Anon <umi_anon@somecompany.com>, Allison Who <allison_who@somecompany.com>, "gabby.where@other.com." <gabby.where@other.com.>|: Only able to parse up to "Umi Anon <umi_anon@somecompany.com>, Allison Who\t<allison_who@somecompany.com>, \"gabby.where@other.com.\"\t<gabby.where@other.com.">]], @name="Cc", @element=nil, @value="Umi Anon <umi_anon@somecompany.com>, Allison Who\r\n\t<allison_who@somecompany.com>, \"gabby.where@other.com.\"\r\n\t<gabby.where@other.com.>", @charset=#<Encoding:UTF-8>> @field_order_id=14>
As you can see, there's a Mail::Field::IncompleteParseError in the header itself, and we're ultimately receiving a string value from @mail.cc instead of an array of strings.
We were able to reproduce the error by mimicking some of the mail gem code:
class_name = Mail.const_get('CcField')
unfolded_anon = "Umi Anon <umi_anon@somecompany.com>, Allison Who\r\n\t<allison_who@somecompany.com>,
\"gabby.where@other.com.\"\r\n\t<gabby.where@other.com.>".gsub(UNFOLD_WS, '\1')
class_name.parse(unfolded_anon, 'utf-8')
/usr/local/bundle/gems/mail-2.8.1/lib/mail/parsers/address_lists_parser.rb:33233:in `parse': Mail::AddressList can not parse |Umi Anon <umi_anon@somecompany.com>, Allison Who <allison_who@somecompany.com>, "gabby.where@other.com." <gabby.where@other.com.>|: Only able to parse up to "Umi Anon <umi_anon@somecompany.com>, Allison Who\t<allison_who@somecompany.com>, \"gabby.where@other.com.\"\t<gabby.where@other.com." (Mail::Field::IncompleteParseError)
The text was updated successfully, but these errors were encountered:
Here's how we're retrieving email objects from AWS S3 and then using the mail gem to parse them:
Here's an anonymized copy of a CC mail header we encountered this week:
As you can see, there's a
Mail::Field::IncompleteParseError
in the header itself, and we're ultimately receiving a string value from@mail.cc
instead of an array of strings.We were able to reproduce the error by mimicking some of the
mail
gem code:The text was updated successfully, but these errors were encountered: