sendgrid / docs

Repository of Twilio SendGrid's product documentation.
https://sendgrid.com/docs
MIT License
236 stars 967 forks source link

Email erroneously bouncing with "multiple To: headers" #6586

Closed dyost17 closed 3 years ago

dyost17 commented 3 years ago

Greetings,

SendGrid (Twilio) support referred me to you here. Several days ago, on or about Aug 12, our multi-recipient mail started bouncing. The bounces claim things like:

A message was received from this address by our systems that had errors in the SMTPAPI header, and cannot be processed due to the following:

  - 2 duplicate to header detected, rfc5322 states that there should be a max of 1

If you require assistance in working with the SendGrid API, please contact us at support@sendgrid.com

Problem is, our raw-socket SMTP code hasn't changed in probably a literal decade, and it does NOT use multiple To: headers. Just one. Multiple recipients in the To: header are separated by commas:

To: whatever@domain1.com, whoever@domain2.com

Went back and grabbed an email (that had worked) from recipient-side from prior to roughly Aug 12, and sure enough (excerpt, redacted):

Received: from o2.email.avrmail.net (198.37.146.150) by
 BN8NAM12FT012.mail.protection.outlook.com (10.13.182.123) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.4415.5 via Frontend Transport; Wed, 11 Aug 2021 21:40:13 +0000
Received: by filterdrecv-7c9f9f88f-mt88x with SMTP id filterdrecv-7c9f9f88f-mt88x-1-611443BD-1B
        2021-08-11 21:40:13.43816916 +0000 UTC m=+1394427.752066468
Received: from apikey (unknown)
    by geopod-ismtpd-2-0 (SG) with ESMTP id uHhcq8b2T4eN0rAN8adWpg
    Wed, 11 Aug 2021 21:40:12.217 +0000 (UTC)
From: "This Company" <autoreports@company.net>
To: <person1@domain.net>, <person2@domain.com>, <person3@domain3.com>
Subject: System message for process 10
Date: Wed, 11 Aug 2021 21:40:13 +0000 (UTC)
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <uHhcq8b2T4eN0rAN8adWpg@geopod-ismtpd-2-0>
X-SG-EID: UsGWDRPdlddNBJcvwaqWg/UCXXb26nrcEW2o0qVaU0hFnjNNLsR4LjJ5svIL4IachXjcNYibuE2zXB
 vO7V+cPUoOrF7s9GHX9OJc9apGHSES+CmNQxGL8ct/vpF0YxEfKTqwYsGgIH9yEZZcWsBX7eQw9H54
 cLTnepaia9jfEE5ENMlALZVRu21Zsrl3H0CJ7/K3muM4ZIjjl+ZNnrKn/fcW6nF9D9VXNdZb46Ohxs
 Y=

One To: header, multiple recipients there, is fine.

This is a serious problem but Support claims they can only assume it must be on our side.

No?

kshairrick commented 3 years ago

Anything happening on this? This is a major problem that we have been experiencing for a week now and have seen no signs that this is being looked at.

barnyrelph commented 3 years ago

Also affecting my customers in production. Like OP, we've had no change in mail sending code or recipients in a long time now.

dyost17 commented 3 years ago

Confession time, we actually discovered an underlying open source lib that was handling raw comms on the wire...and sure enough it was doing linebreaks with another To: header. Don't know why, but it was. We're getting that rebundled, sorry for the false alarm.

dyost17 commented 3 years ago

@barnyrelph hope you get yours resolved, though.