mail
mail copied to clipboard
Failed parse of received header containing <multiple recipients>
we are running mail from the 2-5-stable branch
seeing this. Is there any more info I can provide?
self.raw_message.received.errors
[[#<ActiveSupport::Multibyte::Chars:0x007ffbf6d82ad0 @wrapped_string="Received">, #<ActiveSupport::Multibyte::Chars:0x007ffbf6d82788 @wrapped_string="from [192.168.1.186] ([206.248.139.39]) by mx.google.com with ESMTPSA id m10sm4741360qae.12.2013.08.06.07.40.15 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 07:40:18 -0700 (PDT)">, #<Mail::Field::ParseError: Mail::ReceivedElement can not parse |from [192.168.1.186] ([206.248.139.39]) by mx.google.com with ESMTPSA id m10sm4741360qae.12.2013.08.06.07.40.15 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 07:40:18 -0700 (PDT)|
Reason was: Expected one of
, (, @, > at line 1, column 127 (byte 127) after from [192.168.1.186] ([206.248.139.39]) by mx.google.com with ESMTPSA id m10sm4741360qae.12.2013.08.06.07.40.15 for <multiple >]]
@glongman The entire set of headers for the email would be nice, if not; just the full text of the received headers will be necessary to track this down.
Thanks!
Thanks for looking at this. I will get them but it will be a little while.
Unfortunately for reasons out of my control I can't get you the additional info you asked for. The raw text of the broken header is in the snippet I included in the original report. here it is extracted from above
from [192.168.1.186] ([206.248.139.39]) by mx.google.com with ESMTPSA id m10sm4741360qae.12.2013.08.06.07.40.15 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 07:40:18 -0700 (PDT)
Mail's parser doesn't like <multiple recipients>
.
Sorry I can't get you more, I hope this is enough to go on.
@glongman I've found that trying to parse Received headers is a fools errand. There are so many non-conforming MTAs out there. I've actually turned it into an UnstructuredField in our fork of Mail at SaneBox.
FWIW, the recent parser rewrite (currently in master) will likely be able to parse this without issue. The treetop based parser in 2.5 uses the RFC2822 grammar for Received headers which as @peterkovacs mentioned is often not conformed to. RFC5322, which the new parser generally follows, specifies a much more liberal grammar for the everything before the datetime in a received header.
@bpot I've actually had the same errors in master using the new ragel parser. That's what I was basing my comment on.
Confirmed, still fails on current master:
>> Mail::ReceivedField.new('from [192.168.1.186] ([206.248.139.39]) by mx.google.com with ESMTPSA id m10sm4741360qae.12.2013.08.06.07.40.15 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 07:40:18 -0700 (PDT)')
Mail::Field::IncompleteParseError: Mail::ReceivedElement can not parse |from [192.168.1.186] ([206.248.139.39]) by mx.google.com with ESMTPSA id m10sm4741360qae.12.2013.08.06.07.40.15 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 07:40:18 -0700 (PDT)|: Only able to parse up to "from [192.168.1.186] ([206.248.139.39]) by mx.google.com with ESMTPSA id m10sm4741360qae.12.2013.08.06.07.40.15 for <multiple "
I'm receiving a similar error as well.
[["Received","by mx0015p1iad2.sendgrid.net with SMTP id uLtTjyzRZX Fri, 08 Jan 2021 03:14:53 +0000 (UTC)","Mail::ReceivedElement can not parse |by mx0015p1iad2.sendgrid.net with SMTP id uLtTjyzRZX Fri, 08 Jan 2021 03:14:53 +0000 (UTC)|: Only able to parse up to \"by mx0015p1iad2.sendgrid.net with SMTP id uLtTjyzRZX Fri\""]]