[英]How to pass dynamic url to gmail viewAction method of Go-to Action using magento?
我是新来的发展。 我想在gmail帐户主题中开发跟踪订单按钮。 就像下面的图片在这里输入图片说明
示例:code.gs
function testSchemas() {
var htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();
MailApp.sendEmail({
to: Session.getActiveUser().getEmail(),
subject: 'Tracking Order status in the Inbox - ' + new Date(),
htmlBody: htmlBody,
});
}
mail_template.html
<html>
<head>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://checkout.example.com/sales/order/view/order_id/1666039/",
"name": "Track Order"
},
"description": "See the order status"
}
</script>
</head>
<body>
<p>
This a test for a Go-To action in Gmail.
</p>
</body>
</html>
如何传递目标属性的动态值?
提前致谢!
您可以在电子邮件模板中使用模式,并在发送电子邮件之前替换该值。
例如:在mail_template.html中
https://checkout.example.com/sales/order/view/order_id/{orderId}/
在testSchemas()中
var htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();
htmlBody = htmlBody.replace(/{orderId}/g, idOfTheOrder);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.