Closed spib closed 1 year ago
Hey there! I noticed a line break between line 6 and 7, which is not supposed to happen. How was the email originally parsed? Via mailparser
?
I removed the line break:
---------- Forwarded message ---------
From: Sender <sender@email.com>
Date: Fri, 25 Feb 2022 at 18:08
Subject: Test Email
To: Recipient <recipient@email.com>
Cc: Recipient 1 <recipient1@email.com>, Recipient 2 <receipient2@email.com>, Recipient 3 <recipient3@email.com>
Email Start Here...
And the result is now ok:
{
"forwarded": true,
"message": null,
"email": {
"body": "Email Start Here...",
"from": {
"address": "sender@email.com",
"name": "Sender"
},
"to": [
{
"address": "recipient@email.com",
"name": "Recipient"
}
],
"cc": [
{
"address": "recipient1@email.com",
"name": "Recipient 1"
},
{
"address": "receipient2@email.com",
"name": "Recipient 2"
},
{
"address": "recipient3@email.com",
"name": "Recipient 3"
}
],
"subject": "Test Email",
"date": "Fri, 25 Feb 2022 at 18:08"
}
}
Thanks for the super-quick reply. We're receiving the messages via SendGrid's Inbound Parse webhook (https://docs.sendgrid.com/for-developers/parsing-email/setting-up-the-inbound-parse-webhook#example-default-payload) and using the plain-text version of the email.
It does seem to be a known issue that GMail will wrap plain-text to 78 characters (https://fix.lazyjeff.com/2013/02/why-does-gmail-wrap-text-in-my-emails.html).
Are you guys using the html version of the email or plain text?
Ok, in that case my advise would be to use a dedicated parser like mailparser and give it the raw email. As a result you will get a clean, un-wrapped text representing the email.
Then you can pass that text to email-forward-parser
.
Thanks for providing this library, it's excellent.
I wonder if you've ever seen an issue we're seeing where when we pass the plain-text email text to the library which has come from gmail, the lines are wrapped at 78 characters. This means that the cc list doesn't get parsed correctly and we end up with incomplete recipient lists. An example of how those emails look is shown below.