mail icon indicating copy to clipboard operation
mail copied to clipboard

Failed parse of received header containing <multiple recipients>

Open glongman opened this issue 11 years ago • 8 comments

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 avatar Aug 13 '13 13:08 glongman

@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!

ConradIrwin avatar Aug 13 '13 15:08 ConradIrwin

Thanks for looking at this. I will get them but it will be a little while.

glongman avatar Aug 13 '13 16:08 glongman

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 avatar Aug 15 '13 11:08 glongman

@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.

peterkovacs avatar Aug 17 '13 13:08 peterkovacs

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 avatar Aug 17 '13 20:08 bpot

@bpot I've actually had the same errors in master using the new ragel parser. That's what I was basing my comment on.

peterkovacs avatar Aug 18 '13 12:08 peterkovacs

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 "

jeremy avatar May 17 '17 03:05 jeremy

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\""]] 

c-moyer avatar Jan 25 '21 21:01 c-moyer