This repository has been archived on 2025-03-31. You can view files and clone it, but cannot push or open issues or pull requests.

33 lines
723 B
JavaScript

function doPost(e)
{
if (!e.parameter.hasOwnProperty('subject') || !e.parameter.hasOwnProperty('body')) {
return HtmlService.createHtmlOutputFromFile('noparams');
}
var quota = MailApp.getRemainingDailyQuota();
if (quota > 0) {
// TODO: Add additional headers?
MailApp.sendEmail({
to: Session.getActiveUser().getEmail(),
subject: e.parameter.subject,
htmlBody: e.parameter.body,
});
return HtmlService
.createTemplateFromFile('mailedit')
.evaluate();
} else {
// quota == 0, exceeded!
return HtmlService
.createHtmlOutputFromFile('quotaexceeded');
}
}
function doGet(e)
{
return HtmlService.createHtmlOutputFromFile('noparams');
}