Email markup-Gmail modifying the <script> tag to add extra string "3D"
Asked Answered
A

2

11

I am using Ruby on Rails to generate the email. As mentioned in the Email markup docs, i modified my (*.html.haml) templates to include the schema for Email markup. Below code is from my mailer template:

%script{ type: "application/ld+json" }
  {
  "@context" : "http://schema.org",
  "@type" : "FoodEstablishmentReservation",
  "reservationNumber" : "#{reservation.id}",
  ...
  }

I also modified the sender and receiver of the email to the same email id as mentioned here for testing the schema in development mode.

When i receive the email in my Gmail inbox, and i don't see anything different from before. When i check the Original Message of the email, it shows:

Return-Path: <[email protected]>
...
Date: Wed, 21 Dec 2016 13:14:45 +0530
From: [email protected]
To: [email protected]
...
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="--==_mimepart_585a32ecf2d94_143673fd10d24128893014"; charset=UTF-8
Content-Transfer-Encoding: 7bit

----==_mimepart_585a32ecf2d94_143673fd10d24128893014
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
...
<script type=3D'application/ld+json'>
  {
  "@context" : "http://schema.org",
  "@type" : "FoodEstablishmentReservation",
  "reservationNumber" : "<reservation-id>",
  ...
  }
</script>
...

Now, if i validate this <script> tag content in the Email markup tester, it says "no structured data is present", but as soon as i remove "3D" from <script> tag and make it <script type='application/ld+json'>, it extracts the structured data correctly for all the fields.

So, i am unable to figure out why this extra string "3D" is being added to the HTML? Is it because of Haml? or Gmail does it? AND is there anything i can fix to test this Email markup in development environment. Let me know if more info is needed.

Abernethy answered 21/12, 2016 at 8:30 Comment(2)
It is an email encoding system, which allows non-ASCII characters to be represented as ASCII for email transportation. This encoding is called "quoted-printable", that is why there is a 3D value in your email. If you will check this related SO post, which discussed some ways to avoid this like changing it to "Content-Transfer-Encoding". Hope this helps.Villain
Did you find how to solve this?Dollhouse
A
2

I had this same problem. It turns out I had a few misunderstandings which I will help clarify:

1) As pointed out above, the "Original Message" you saw in gmail was encoded as quoted-printable. You first have to decode the message, e.g. using Quoted Printable Converter, and the decoded message does not contain any 3Ds. The decoded message will then validate correctly (presumeably) using the Email Markup tester you referenced.

2) I arrived at this thread because I was debugging my integration using email markup. The markup wasn't showing in test emails and I thought I was implementing it incorrectly. I discovered my email schema integration must be whitelisted by Google to use these features.

I hope this helps.

Absorb answered 19/6, 2018 at 20:56 Comment(1)
You donʼt need to register with Google to send test emails from yourself to yourself on the same account, which OP was doing. From the docs: “All schemas you send to yourself (from [email protected] to [email protected]) will be displayed in Google products. So go ahead and try it out now!”Unbroken
K
0

you can try adding this meta tag in header

 <meta charset="charset=ISO-8859-1"/>
Keek answered 2/11, 2017 at 8:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.