Adding (subject line) actions to Gmail using Schemas

You ever see those buttons in Google email subject lines? I see them mostly on orders where there is a tracking button right in the subject line.

Here’s how it’s done, or at least a way to test it.

Keep in mind that this won’t work until you register the domain that the email is coming from.

Google tutorial –

You can go to and test it.

function testSchemas() {
  var htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();

  to: Session.getActiveUser().getEmail(),
  subject: 'Testing Gmail action Schemas :',
  htmlBody: htmlBody,


<script type="application/ld+json">
 "@context": "",
 "@type": "EmailMessage",
 "description": "Check this out",
 "action": {
   "@type": "ViewAction",
   "url": ""
<p>This a test for a Go-to action in Gmail.</p>

Here is another Google resource for testing scripts.

Thank you for reading!

It's only fair to share...Tweet about this on Twitter
Share on Facebook
Email this to someone
This entry was posted in Email Dev and tagged , , , , , , . Bookmark the permalink.