Msg91 Help Doc
Email
What is Gmail Markup and How to Use It?

What is Gmail Markup and How to Use It?

Gmail Markup enhances your emails by allowing recipients to take quick actions directly from their Gmail inbox. With this feature, users can interact with emails - such as checking into a flight, confirming an event, or tracking an order - without opening the email fully or clicking external links.

Example Use Case:

For an event reservation email, Gmail Markup can display an "Add to Calendar" button to allow users to add the event to their calendar, and a "Directions" button to get directions to the event directly from their inbox.

Screenshot 2025-04-28 at 2.13.17 PM.png

Testing Gmail Markup

If you want to test before whitelisting your email ID, follow these simple steps:

  1. Visit script.google.com

  2. After visiting, select 'New Project' from the left side.

  3. You will see a file named Code.gs on the left side.

  4. Replace the content of Code.gs with the following code.

    /**
     * Send an email with schemas in order to test email markup.
     */
    function testSchemas() {
      try {
        const htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();
    
        MailApp.sendEmail({
          to: Session.getActiveUser().getEmail(),
          subject: 'Test Email markup - ' + new Date(),
          htmlBody: htmlBody
        });
      } catch (err) {
        console.log(err.message);
      }
    }
  5. Click on Save

  6. Next, click on the left top side Files (+) icon, select HTML, and name the file mail_template to match the parameter used in the JavaScript above.

  7. Replace the content of HTML with the following code & Click on Save

    <!--
     Copyright 2022 Google LLC
    
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
    
          http://www.apache.org/licenses/LICENSE-2.0
    
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
    -->
    
    <html>
      <head>
      <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "FlightReservation",
      "reservationNumber": "RXJ34P",
      "reservationStatus": "http://schema.org/Confirmed",
      "underName": {
        "@type": "Person",
        "name": "Eva Green"
      },
      "reservationFor": {
        "@type": "Flight",
        "flightNumber": "110",
        "airline": {
          "@type": "Airline",
          "name": "United",
          "iataCode": "UA"
        },
        "departureAirport": {
          "@type": "Airport",
          "name": "San Francisco Airport",
          "iataCode": "SFO"
        },
        "departureTime": "2027-03-04T20:15:00-08:00",
        "arrivalAirport": {
          "@type": "Airport",
          "name": "John F. Kennedy International Airport",
          "iataCode": "JFK"
        },
        "arrivalTime": "2027-03-05T06:30:00-05:00"
      }
    }
    </script>
    

    To test the script:

    1. Select the tab for Code.gs

    2. Make sure the function testSchemas is selected in the Select function dropdown menu.

    3. Click Run in the Apps Script development environment.To test the script:

      Screenshot 2025-04-28 at 3.34.03 PM.png


The first time you run the script, you'll be asked to grant authorization.
Once you grant the authorization and the script runs successfully, check your inbox for an email sent from yourself — similar to the following screenshot:


Screenshot 2025-04-28 at 3.37.21 PM.png


Types of Actions & Interactive Cards

Gmail Markup supports a variety of actions and interactive cards, allowing different types of user interactions such as:

  • Flight check-ins

  • Event confirmations

  • Order tracking

  • And more

For a full list of supported actions, refer to the Gmail Markup Documentation

To test different cards, such as event confirmation or order tracking, follow these steps:

  1. Copy the necessary code (either in JSON-LD or Microdata format).

  2. Paste the code into the script section of the HTML (from the <head> tag to the bottom).

  3. Run the script to test the implementation and ensure it works seamlessly.

If you're having trouble running a Gmail markup template, add the code to the Email Markup Tester to validate the structured data

Whitelisting Process


To enable Gmail Markup actions in your emails, Google needs to whitelist your email address.

How to get whitelisted:
Follow the steps in this link to submit your email for whitelisting.

Once your email address is whitelisted, interactive features (such as buttons and actions) will be visible in your emails. Copy the required code in JSON-LD (recommended) and paste it into the HTML & Text Editor of your MSG91 email account to run your interactive email campaign smoothly.

By following this simple step, you can easily design your interactive email template using Gmail markup.

Prev