Skip to content

Instantly share code, notes, and snippets.

@ashimon83
Last active June 29, 2017 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashimon83/3e25edb3cab133f4a615ac8d0cc17a0c to your computer and use it in GitHub Desktop.
Save ashimon83/3e25edb3cab133f4a615ac8d0cc17a0c to your computer and use it in GitHub Desktop.
メール送信用Google App Script
function sendTestMail(e) {
var html = HtmlService.createHtmlOutputFromFile("message").getContent();
var items = e.response.getItemResponses();
var mailDom = '';
var mailTo = '';
var title = '';
items.forEach(function(item){
switch(item.getItem().getTitle()){
case 'mailDom':
mailDom = item.getResponse();
break;
case 'mailTo':
mailTo = item.getResponse();
break;
case 'title':
title = item.getResponse();
}
})
MailApp.sendEmail({
to: mailTo,
subject: title || 'HTMLメール送信テスト',
htmlBody: mailDom
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment