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

2.8k views Asked by At

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.

2

There are 2 answers

1
Ben Adams On

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.

0
Sarath Ak On

you can try adding this meta tag in header

 <meta charset="charset=ISO-8859-1"/>