Gmail defaulting to plain text version of emails? - gmail

Running into a strange issue. I have an API which sends HTML emails to clients. Worked perfectly fine with no issues for many years. The emails are sent with <!DOCTYPE html><html> <head> </head> <body> tags and no plain text version. Just recently after having a new recipient, they report that their Gmail is only showing the plain text version of the email (which there isn't any.) When I send the same emails to other Gmail accounts, including my own, there is no problem at all, it will read the HTML version and display it.
In the 'show original' portion of Gmail, it shows:
Subject: TEST
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="--==_mimepart_631155cb3323e_7d7a2af5f0c4393c24919be"; charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_631155cb3323e_7d7a2af5f0c4393c24919be
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Please view the HTML version
----
----==_mimepart_631155cb3323e_7d7a2af5f0c4393c24919be--
I'm at a loss as to why in this one particular person's case it is showing only plain text? Should I add the content-type: text/html into my email? Why would this particular person's Gmail need that when no other one has for years? I couldn't find a setting anywhere in Gmail that defaults to plain text, but maybe there is one somewhere? Or is there some security setting that forces plain text for unknown senders?

Related

email report sent with java not consistently showing Content-Disposition: inline images in gmail

We have an internal report that is sent as an html email. The html contains a table and the first cell of each row in the table is an image.
The image is added like this:
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-ID: <image-0>
Content-Disposition: inline
and in the html part:
<td style="text-align:right; padding-left:10px" align="right"><img src="cid:image-0"></td>
This is made to work in gmail as it is viewed in gmail only. it works fine on my machine and as far as I know everyone else except one person has an issue in which some of the image are never displayed. All tricks about cleaning cache, refreshing, restarting do not help. It also seems to be consistently the same images that are not displayed. And they are "randomly" not showing. so it's not just at the start or end but just "randomly" in the table.
Therefore what could cause this? Is there some settings in gmail or even chrome affecting this? I was thinking some kind of size limit (as in kb of a specific image)?
EDIT:
turns out I'm affected too and other users as well. The images don't load consistently and refreshing will load different images and fail with others (race condition?). Even more the email displays fine in the gmail mobile application.

How to send email as EML attachment with SendGrid

I've got a webhook which is parsing emails sent by SendGrid's Inbound Parse, and if any error occurs with processing the email, I want to send the original email as an EML attachment to a notification email address.
I've been using Busboy to parse the multipart/form-data received by the webhook and I receive the full plain cleartext of the email contents itself. Everything is fine there.
When I go to send the email using #sendgrid/mail and set the original email as an EML attachment file, this is where I get issues.
I've tried a variety of content encodings and mimetypes, but haven't found one that works yet as a EML file. I've tried text/plain, message/rfc822 and application/octet-stream with plain text (which results in error from SendGrid API), and base64 encoded text.
In fact, it gets weirder. When I send the email attachment as text/plain with filename ending in .txt, everything seems to be good. When I download the attachment and rename to .eml then it views perfectly in my Mail app.
However, when I send the email attachment as text/plain, message/rfc822 or application/octet-stream with filename ending in .eml, this is where I get inconsistencies. In the email I sent I can see that the filename now ends with .eml.eml and opening the file in my Mail app shows me base64 encoded text (decoding the text gives me the original email contents that I had to encode in order to allow the endpoint to send as an attachment). Viewing the file contents in a text editor looks like this:
Content-Type: text/plain
MIME-Version: 1.0
VGhpcyBpcyB3aGVyZSB0aGUgYmFzZTY0IGVuY29kZWQgZW1haWwgdGV4dCBnb2Vz
My current conclusion is that the SendGrid /v3/mail/send API endpoint is treating attachments with .eml extension in the filename differently and encapsulating the base64-encoded contents within another .eml wrapper. It doesn't seem possible to set an attachment's content to a plain text string as I get a 400 Bad Request from the endpoint if its not base64 encoded.
I haven't been able to find any official documentation about this particular behaviour on this endpoint. The closest I got was this GitHub issue (dated 2018), but it doesn't seem to solve my issue.

SendGrid dynamicTemplateData - HTML content and plaintext content in one email?

I'm trying to figure out how to send a plain text version of my email, alongside the html content generated by dynamicTemplateData and my dynamic template.
Including text as a sibling to dynamicTemplateData results in a broken email.
It looks like SendGrid is including a text/plain email alongside the text/html content, but it's empty.
Does anybody know how to inject a text/plain version of my email?
Twilio SendGrid developer evangelist here.
When you preview your dynamic template, you can check it out in Desktop, Mobile and Plain Text versions. You can set SendGrid to automatically create a plain text version of the email from your HTML variant, or you can choose to write your own plain text version.
See the screenshot below for more detail:

How do I send an email with a thumbnail using smtp?

When ever I send an email using the SMTP the receiver receives it without a thumbnail mostly Gmail would set it to a "?" which makes the emails look very sketchy. How do I add my logo/avatar for thumbnail of my emails?
Below is an example of a vCard that contains an embedded GIF image encoded in base64 format that travels within the vCard itself; not the email.
...
--content-boundary-mixed
Content-Type: text/v-card; name="vCard.vcf"
Content-Transfer-Encoding: 7-bit
Content-Disposition: attachment; filename="vCard.vcf"
BEGIN:VCARD
VERSION:3.0
FN;CHARSET=UTF-8:First Middle Last
N;CHARSET=UTF-8:Last;First;Middle;Mr.;III
NICKNAME;CHARSET=UTF-8:user1
GENDER:O
UID;CHARSET=UTF-8:c460ac7c-1fd9-4fe1-89ed-17f0d2006df1
EMAIL;CHARSET=UTF-8;type=WORK,INTERNET:user1#example.com
LOGO;ENCODING=b;TYPE=GIF:R0lGODdhYABgAPAAABteIMlFJiH5BAEAAAEALAAAAABgAGAAAAJ
uhI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMKpfMpvMJjU
qn1Kr1is1qt9yu9wsOi8fksvmMTqvX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg4SFhoeIiYqLiIUgAAO
w==
PHOTO;ENCODING=b;TYPE=GIF:R0lGODdhYABgAPAAALccHMlFJiH5BAEAAAEALAAAAABgAGAAAA
JuhI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMKpfMpvMJj
Uqn1Kr1is1qt9yu9wsOi8fksvmMTqvX7Lb7DY/L5/S6/Y7P6/f8vv8PGCg4SFhoeIiYqLiIUgAA
Ow==
TEL;TYPE=CELL:(801) 333-3333
TEL;TYPE=WORK,VOICE:(801) 555-5555
LABEL;CHARSET=UTF-8;TYPE=WORK:123 Main St\nSalt Lake City\, UT 84101
ADR;CHARSET=UTF-8;TYPE=WORK:;;123 Main St;Salt Lake City;UT;84101;United Sta
tes of America
TITLE;CHARSET=UTF-8:Systems Administrator
ORG;CHARSET=UTF-8:XYZ Inc.
URL;type=WORK;CHARSET=UTF-8:https://www.example.com
NOTE;CHARSET=UTF-8:Just a personal note.
REV:2021-04-10T15:21:18.119Z
END:VCARD
--content-boundary-mixed--
SMTP does not support a way to send the profile/contact picture along.
A partial solution is to create a GSuite account (commercial), this gives businesses the chance to use gmail for their own domain names.
And it will also let you set a pictures for your business accounts.
But it's not a complete solution. While other gmail and gsuite users will see this picture when they receive your e-mail, it won't work for all e-mail clients and providers.
What you could do as a (rather poor) alternative, is to send a vCard along with your e-mail. That's like a digital business card.

Spam Assassin reports PP_MIME_FAKE_ASCII_TEXT MIME text/plain claims to be ASCII but isn't

When emailing via Sendgrid SMTP from Gmail using https://www.mail-tester.com/ it reports SpamAssassin says "PP_MIME_FAKE_ASCII_TEXT MIME text/plain claims to be ASCII but isn't".
Sending the same content from the Gmail address via Gmail's SMTP servers to mail tester does not give this error.
What is going on? How do I fix this error?
Update 2021-03-07 Sendgrid say they require the "SMTP payload" sent from Gmail to their SMTP server. Any suggestions how I can get this?
Thanks
An email entity that claims to be 7bit text contains 8bit characters.
Maybe Google is fixing it for you and sendgrid isn’t.
Check the source of the email you are sending and compare it with what you receive from Google.

Resources