I am using below code to schedule the calendar event but it is not working. I am able to get an email but calender event is not scheduled automatically.
mail_tamplate.html
<html>
<head>
<script type="application/ld+json">
{
"@context": "http://www.schema.org",
"@type": "Event",
"eventStatus": "https://schema.org/ConfirmAction",
"name": "Rahul Kumar",
"description": "Desc of event",
"startDate": "2017-01-05T20:00",
"endDate": "2017-01-05T21:00",
"location": {
"@type": "Place",
"name": "South Ex",
"address": {
"@type": "PostalAddress",
"streetAddress": "178-C",
"addressLocality": "Meerut",
"addressRegion": "Uttar Pradesh",
"postalCode": "250001",
"addressCountry": "India"
}
}
}
</script>
</head>
<body>
<p>
This a test for a Go-To action in Gmail.
</p>
</body>
</html>
code.gs
function testSchemas() {
var htmlBody = HtmlService.createHtmlOutputFromFile('mail_template').getContent();
MailApp.sendEmail({
to: Session.getActiveUser().getEmail(),
subject: 'Test Email markup - ' + new Date(),
htmlBody: htmlBody,
});
}
AFAIK, this is not possible.
Interaction with the user is needed before the event is added. Hope this helps.