我目前正在使用脚本从Google表格发送电子邮件。
我想附加一个签名,但是当我查看发送的电子邮件时,我的签名现在作为一个非常长的html字符串出现。我如何将其更改为看起来像我的正常签名(带有图片等)的任何想法
当前脚本:
var EMAIL_SENT = "EMAIL_SENT";
function sendEmails() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.setActiveSheet(ss.getSheetByName("Email"));
var sheet = SpreadsheetApp.getActiveSheet();
var dataRange = sheet.getRange("B7:I100");
var startRow = 7
var data = dataRange.getValues();
for (var i = 0; i < data.length; ++i) {
var rowData = data[i];
var emailAddress = rowData[1];
var ccEmailAddress = rowData[3]
var message = rowData[7];
var subject = rowData[5];
var signature = Gmail.Users.Settings.SendAs.list("me").sendAs.filter(function(account){if(account.isDefault){return true}})[0].signature;
var emailSent = rowData[9];
if (emailSent != EMAIL_SENT && emailAddress)
var aliases = GmailApp.getAliases()
Logger.log(aliases); //returns the list of aliases you own
Logger.log(aliases[0]); //returns the alias located at position 0 of the aliases array
;{// Prevents sending duplicates
GmailApp.sendEmail(emailAddress, subject, message +signature,{'from': aliases[0]});
sheet.getRange(startRow + i, 10).setValue(EMAIL_SENT); // Make sure the cell is updated right away in case the script is interrupted
}}}