0

I've been looking at email Actions (which apparently are in a process of being standardized), and considering implementing these for an application of mine.

However, the entire documentation seems to be missing the mime-type to define for the message part that includes this json-ld metadata. For example, gpg signatures are marked as

Content-Type: application/pgp-signature; name="signature.asc"

What Content-Type does this part (eg: this content) need to be included as?

WhyNotHugo
  • 9,423
  • 6
  • 62
  • 70

1 Answers1

1

You have to include it in the email’s HTML (text/html).

Google (i.e., Gmail and Inbox by Gmail) supports JSON-LD and Microdata:

  • The JSON-LD will be included in a script element (used as data block).

  • The Microdata attributes (like itemscope and itemprop) will be added directly to the (existing) HTML elements.

So, if your email would contain this HTML

<html>
  <body>
    <p>Foobar</p>
  </body>
</html>

you could add JSON-LD to it like this

<html>
  <body>
    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Thing",
      "name": "Foobar"
    }
    </script>
    <p>Hello!</p>
  </body>
</html>

and Microdata like this

<html>
  <body itemscope itemtype="http://schema.org/Thing">
    <p itemprop="name">Foobar</p>
  </body>
</html>
Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • So, if I understand correctly, I **need** to use html email in order to include this meta data? It's not a separate mime part? – WhyNotHugo May 23 '15 at 18:37
  • @Hugo: Yes, according to Google’s documentation, they only support the Schema.org annotations if used in HTML. I guess (didn’t test it) you could send both, `text/plain` and `text/html`, in `multipart/alternative` and [place the `text/plain` version last](http://en.wikipedia.org/wiki/HTML_email#Multi-part_formats) (if you want clients to prefer the plain text version). – unor May 24 '15 at 13:28
  • 1
    Thanks, but I'd much rather avoid adding any text/html parts to my emails. Hopefully this will be improved at some point, and these actions will become a separate mime-part. – WhyNotHugo May 28 '15 at 19:41
  • 1
    @Hugo You could use it as a separate mime type but the issue is that some clients(i.e. gmail) don't recognise it. I think the best way to handle this would be to send both both html (with the json-ld embedded) and a separate json-ld mime so that we can 'force' the clients to consider supporting it. I would like a separate mime too so that I can send only the json-ld and perhaps the 'text/plain' version as fallback but we are really at the mercy of the major email clients(i.e. ios email, gmail, yahoo, outlook, mozilla). – themihai Aug 08 '16 at 12:27