无法获取Gmail单击确认操作按钮工作 [英] Can't get gmail one click confirm action button working

查看:71
本文介绍了无法获取Gmail单击确认操作按钮工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照此处所述的指导方针进行操作

https://developers.google.com/gmail/schemas/reference/one-click-action



但它不会显示给我。如此处所述


自检

您可以使用
发送电子邮件,轻松测试您的标记是否正常工作模式到您的Gmail帐户。所有电子邮件,其中
的发件人和收件人是同一个帐户,忽略
注册要求,可用于自我检测。


我在以下地址使用同一个Gmail地址

  GradeCard gc =新的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;>需要采取措施。确认订阅EN abc< / h3>
< p>
亲爱的< b> abc< / b>
< / p>
< script type =application / ld + json>
{
@context:http://schema.org,
@type:EmailMessage,
description:需要操作。
action:{
@type:ConfirmAction,
name:添加到监视列表,
处理程序 :{
@type:HttpActionHandler,
url:http://www.myignou.com?a=1&b=2
}
}
}
< / script>

< p>根据您的要求,我们已将您的订阅添加到以下详细注册号码< / p>
< p>
...
< / p>
< p>
点击此处<< a href =http://www.myignou.com?a=1&b=2>以确认< / a>
< / p>
< div style =margin:10px 0;>
< p>
以下是您最近的成绩卡复印件,位于< b> 05-09-2013 00:03:37< / b>< br />
变更ID:xxx
< / p>

< table style =width:100%; text-align:center; border-collapse:collapse;>
....
< / table>
< h3 style =font-weight:lighter;>其他以前的更改< / h3>
< div style =padding:10px>
< h4 style =font-weight:lighter; margin:0>于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>于03-09-2013 15:14:21更新< / h4>
< div>变更ID:xxx< / div>
< div>
...
< / div>
< / div>
< div style =padding:10px>
< h4 style =font-weight:lighter; margin:0>于03-09-2013 15:14:21更新< / h4>
< div>变更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>


解决方案

如果您检查电子邮件标题,没有发现任何DKIM / SPF签名,即使进行自我测试也是如此。如果没有签名,任何人都可以伪造你的电子邮件地址,并通过行为向你发送不需要的电子邮件。

I am following the guidelines as described here
https://developers.google.com/gmail/schemas/reference/one-click-action

But It's just wont appear for me. As described here

Self testing

You can easily test if your markup is working correctly end-to-end by sending emails with schemas to your Gmail account. All emails where the sender and the recipient are the same account ignore the registration requirements and can be used for self-testing.

I am using my same gmail address in both to and from address like below

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 of generated mail is like this

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

解决方案

If you check the email headers, I'd expect that no DKIM/SPF signature can be found, and that is required even for self-testing. Without the signature, anyone can spoof your email address and send you unwanted email with actions.

这篇关于无法获取Gmail单击确认操作按钮工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆