Search code examples
emailmime-typescontent-typeschema.orggoogle-schemas

Content-Type for Email Markup Actions


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?


Solution

  • 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>