I'm building an internal request-approval system for my company, and the best scenario I'd like to develop is using the amp dynamic emails in Gmail (our company relies on G Suite services).
I made some few tests, and while sending through https://amp.gmail.dev/playground/ is working fine, when I try to send from GAS the amp content is not showing (Developer settings already enabled, my own address is white-listed). Knowing that GAS has some various limitations, I'd like to know if it's even possible to send automated dynamic emails.
function doGet(e) {
var body = HtmlService.createTemplateFromFile('body').evaluate().getContent()
GmailApp.sendEmail(EMAIL_ADDRESS, new Date(), body, { htmlBody : body})
}
the html body
<!DOCTYPE HTML>
<html ⚡4email>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<style amp4email-boilerplate>body{visibility:hidden}</style>
<style amp-custom>
h1 {
margin: 1rem;
}
</style>
</head>
<body>
<body>
<amp-img src="https://placekitten.com/800/400"
alt="Welcome"
width="800"
height="400">
</amp-img>
</body>
</body>
</html>
Chrome (Gmail)
amp-email
cc @zhangsu @fstanis @ampproject/wg-amp4email
I believe Apps Script's GmailApp doesn't support custom MIME types which are required in order to have the text/x-amp-html part. The docs for sendEmail have this:
Sends an email message with optional arguments. The email can contain plain text or an HTML body. The size of the email (including headers, but excluding attachments) is quota limited.
I suggest reaching out to Apps Script support channels to potentially file a feature request.
Most helpful comment
I believe Apps Script's GmailApp doesn't support custom MIME types which are required in order to have the
text/x-amp-htmlpart. The docs forsendEmailhave this:I suggest reaching out to Apps Script support channels to potentially file a feature request.