使用MFMailComposeViewController添加gmail快速操作按钮?

时间:2013-07-16 14:37:02

标签: ios google-schemas

在iOS上使用MFMailComposeViewController时,是否可以在html模板中添加gmail操作按钮?我正试图通过向自己发送电子邮件进行测试,但到目前为止,当我从iOS发送电子邮件时,我无法通过gmail显示操作按钮?

我正在使用保存为Test.html的示例HTML代码:

<html>
  <head>
    <script type="application/ld+json">
    {
      "@context":       "http://schema.org",
      "@type":          "EmailMessage",
      "description":    "Check this out",
      "action": {
        "@type": "ViewAction",
        "url":   "https://www.youtube.com/watch?v=eH8KwfdkSqU"
      }
    }
    </script>
  </head>
  <body>
    <p>
      This a test for a Go-To action in Gmail.
    </p>
  </body>
</html>

发送这样的电子邮件:

MFMailComposeViewController *emailController = [[MFMailComposeViewController alloc] init];
    [emailController setSubject:@"This is a test"];
    NSString *emailFileName = [NSString stringWithFormat:@"Test.html"];
    NSString *emailFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:emailFileName];
    NSString *body = [NSString stringWithContentsOfFile:emailFilePath encoding:NSUTF8StringEncoding error:nil];
    [emailController setMessageBody:body isHTML:YES];

这会弹出我手机上的默认邮件应用程序,然后将电子邮件发送到我的Gmail帐户。我收到电子邮件但在浏览器中查看电子邮件时没有操作按钮(不在iOS上)。我猜它没有用,因为电子邮件没有正确签名?

修改。这是电子邮件来源:

    Return-Path: <erik.maxwell.hunter@gmail.com>
Received: from [10.228.122.48] (mobile-198-228-192-015.mycingular.net. [198.228.192.15])
        by mx.google.com with ESMTPSA id t10sm1451398igz.9.2013.07.16.06.49.19
        for <erik.maxwell.hunter@gmail.com>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 16 Jul 2013 06:49:20 -0700 (PDT)
Content-Type: multipart/alternative; boundary=Apple-Mail-FF6A80E5-6EEB-48DC-AA50-D59C49D21235
Content-Transfer-Encoding: 7bit
Subject: Hey, I shared a photo with you!
From: Personal Gmail <erik.maxwell.hunter@gmail.com>
Message-Id: <3C165C2C-C0F9-444B-85C1-84E96750CA1D@gmail.com>
Date: Tue, 16 Jul 2013 09:49:16 -0400
To: Erik Hunter <erik.maxwell.hunter@gmail.com>
Mime-Version: 1.0 (1.0)
X-Mailer: iPhone Mail (10A403)


--Apple-Mail-FF6A80E5-6EEB-48DC-AA50-D59C49D21235
Content-Type: text/plain;
    charset=us-ascii
Content-Transfer-Encoding: 7bit

This a test for a Go-To action in Gmail.    
--Apple-Mail-FF6A80E5-6EEB-48DC-AA50-D59C49D21235
Content-Type: text/html;
    charset=utf-8
Content-Transfer-Encoding: 7bit

<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>

    <script type="application/ld+json">
    {
      "@context":       "http://schema.org",
      "@type":          "EmailMessage",
      "description":    "Check this out",
      "action": {
        "@type": "ViewAction",
        "url":   "https://www.youtube.com/watch?v=eH8KwfdkSqU"
      }
    }
    </script>


    <p>
      This a test for a Go-To action in Gmail.
    </p>

</div></body></html>
--Apple-Mail-FF6A80E5-6EEB-48DC-AA50-D59C49D21235--

1 个答案:

答案 0 :(得分:1)

缺少签名很可能是按钮未显示的原因。

请在您的问题中添加电子邮件来源,以便我们确认。您可以通过打开下拉菜单并选择“显示原始文件”从Gmail获取。