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