Question

Trying to add "confirm your account" In-App action button to my emails, but it's not working. I've tried moving things, using the validator, putting it in the <head> or the <body> (where should it be, by the way? docs are contradictory).

This is the source of a message I'm trying. Sent using the Gmail SMTP server (secured) from my local dev RoR app to my gmail address:

Return-Path: <me@gmail.com>
Received: from localhost.localdomain (97.248.35.213.dyn.estpak.ee. [213.35.248.97])
        by mx.google.com with ESMTPSA id id.00.00....
        for <me@gmail.com>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Sat, 08 Jun 2013 00:18:04 -0700 (PDT)
Date: Sat, 08 Jun 2013 10:18:02 +0300
From: me@gmail.com
Reply-To: me@gmail.com
To: me@gmail.com
Message-ID: <fdklsfjdklsjfd ... fdsfds@bla.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "EmailMessage",
      "description": "Confirm my account",
      "action": {
        "@type": "ConfirmAction",
        "name": "Confirm my account",
        "handler": {
          "@type": "HttpActionHandler",
          "url": "http://example.com/account/confirmation?confirmation_token=x574WeRJJNUuhiPqfVah",
        }
      }
    }
    </script>
  </head>
  <body>
    <p>Hi there, me@gmail.com!</p>

    <p>You can confirm your account email through the link below:</p>

    <p><a href="http://example.com/account/confirmation?confirmation_token=x574WeRJJNUuhiPqfVah">Confirm my account</a></p>
  </body>
</html>
Était-ce utile?

La solution

The button is not showing up because your email is not signed with DKIM/SPF. Without signature there's no way to prove that the sender is actually yourself and prevent malicious senders from spoofing your email address, so the markup is being ignored. Make sure you add DKIM signing to your code and everything will work as intended.

Also note that you have an extra comma after the handler url and that invalidates your markup. You can use the Schema Validator tool to check your markup:

https://developers.google.com/gmail/schemas/testing-your-schema

Finally, to answer your question about the correct location for the markup, anywhere inside either the <head> or the <body> works fine.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top