Skip to content
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

Failed parse of received header containing <multiple recipients> #600

Open
glongman opened this issue Aug 13, 2013 · 8 comments
Open

Failed parse of received header containing <multiple recipients> #600

glongman opened this issue Aug 13, 2013 · 8 comments

Comments

@glongman
Copy link

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 >]]
@ConradIrwin
Copy link
Collaborator

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

@glongman
Copy link
Author

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

@glongman
Copy link
Author

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.

@peterkovacs
Copy link
Contributor

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

@bpot
Copy link
Contributor

bpot commented Aug 17, 2013

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.

@peterkovacs
Copy link
Contributor

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

@jeremy
Copy link
Collaborator

jeremy commented May 17, 2017

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 "

@c-moyer
Copy link

c-moyer commented Jan 25, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants