【问题标题】:Can't get gmail one click confirm action button working无法让gmail一键确认操作按钮工作
【发布时间】:2013-09-10 04:19:42
【问题描述】:

我遵循此处所述的准则
https://developers.google.com/gmail/schemas/reference/one-click-action

但它只是不会出现在我面前。如上所述here

自测

您可以通过以下方式轻松测试您的标记是否在端到端正常工作 将带有架构的电子邮件发送到您的 Gmail 帐户。所有电子邮件 发件人和收件人是同一个帐户忽略 注册要求,可用于自测。

我在往返地址中都使用了相同的 gmail 地址,如下所示

GradeCard gc = new GradeCard("105106265", "BTS");
var m = new UserMailer().ConfirmSubscription("Shashwat", "user@email.com", new WatchListEmail() { fullName = "from Model", gc = gc });

Response.Write(m.Body);

var client = new SmtpClient("smtp.gmail.com", 587)
{
    Credentials = new NetworkCredential("user@email.com", "xxxxx"),
    EnableSsl = true
};

client.Send(m);

生成邮件的HTML是这样的

<!DOCTYPE html>

<html>
<body>
    <div style="width: 600px; margin: auto; font-family: 'Segoe UI';">
        <h1 style="font-weight:lighter; border-bottom:1px solid #808080; padding:5px 0;">example.com</h1>
        <h3 style="font-weight:lighter;">Action Required. Confirm your subscription for EN abc</h3>
        <p>
            Dear <b>abc</b>
        </p>
        <script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "EmailMessage",
  "description": "Action Required. Confirm your subscription for EN 105106265",
  "action": {
    "@type": "ConfirmAction",
    "name": "Add to watchlist",
    "handler": {
      "@type": "HttpActionHandler",
      "url": "http://www.myignou.com?a=1&b=2"
    }
  }
}
</script>

<p>As you requested, We have just added your subscription to the following detailed enrollment number</p>
<p>
    ...
</p>
<p>
    Click <a href="http://www.myignou.com?a=1&b=2">here to confirm</a>
</p>
<div style="margin:10px 0;">
    <p>
        Here is your most recent copy of grade card as on <b>05-09-2013 00:03:37</b><br />
        Changeset ID: xxx
    </p>

    <table style="width: 100%; text-align: center; border-collapse: collapse;">
        ....
    </table>
    <h3 style="font-weight: lighter;">Other previous changes</h3>
        <div style="padding: 10px">
            <h4 style="font-weight: lighter; margin: 0">Updated on 03-09-2013 15:15:20</h4>
            <div>Changeset ID: abc</div>
            <div>
                ...
            </div>
        </div>
        <div style="padding: 10px">
            <h4 style="font-weight: lighter; margin: 0">Updated on 03-09-2013 15:14:21</h4>
            <div>Changeset ID: xxx</div>
            <div>
                ...
            </div>
        </div>
        <div style="padding: 10px">
            <h4 style="font-weight: lighter; margin: 0">Updated on 03-09-2013 15:14:21</h4>
            <div>Changeset ID: abca</div>
            <div>
                ...
            </div>
        </div>
    </div>
        <div style="padding: 10px; margin: 20px 0; background-color: #f2f0f0; font-size: 85%; color: #686868;">
            <b>&copy; 2013 myIGNOU.com</b><br />

        </div>
    </div>
</body>
</html>

【问题讨论】:

    标签: javascript gmail schema.org google-schemas


    【解决方案1】:

    您必须先获得 Google 的批准才能使其正常工作。

    为此:

    1. 将您经过验证的包含架构的电子邮件发送到一个特殊的谷歌电子邮件地址(使用此工具:https://www.google.com/webmasters/markup-tester/u/0/)...然后:

    2. 填写“Gmail 架构白名单请求”表单,描述您的网站以及您打算通过一键操作执行的操作。表格如下:https://docs.google.com/forms/d/1PA-vjjk3yJF7MLPOVKbIz3MBfhyma2obS8NIZ0JYx8I/viewform?pli=1&fbzx=-1177483801701354615

    【讨论】:

      【解决方案2】:

      如果您检查电子邮件标头,我预计找不到 DKIM/SPF 签名,即使是自测也是必需的。如果没有签名,任何人都可以欺骗您的电子邮件地址并向您发送不需要的电子邮件。

      【讨论】:

      • 感谢您的回复。正如您在其他答案中所建议的那样。我用 script.google.com 成功测试了它。但是有没有办法在从谷歌帐户(gmail)发送电子邮件时添加 DKIM/SPF 签名..?
      • DKIM 使用域密钥,因此您需要一个 Google Apps 域来执行此操作
      • 是的,需要 DKIM/SPF 签名。即使使用相同的发件人和收件人电子邮件地址,您也无法对其进行测试。我正在使用 ManDrilApp。哪个正在工作。 @RahulChaudhari
      猜你喜欢
      • 1970-01-01
      • 2017-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多