我「犯了一個綁定腳本掃描其電子表格的記錄,如果某些條件,則電子郵件被髮送到合適的員工MailApp.sentEmail L不工作了(谷歌應用程序腳本)
更具體的腳本是通過檢查列表的員工是否有生日或沒有真正的假值。我的腳本工作了幾個星期,今天它停止發送電子郵件而不改變任何東西
我的代碼
function send() {
//returns the current active spreadsheet
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
var recipient;
var startRow = 2; // First row of data to process
var lastRow = sheet.getLastRow();//Last row to process ,the EOF
var emailSend = "FALSE";//flag to know if the mail has been sent
var d = new Date();//saving the date
var timeStamp = d.getYear();//specifing the years section
//take images location
var wishes_imageURL ="http://dekhnews.com/wp-content/uploads/... nielsen_imageURL="http://www.nielsen.com/content/dam/nielsenglobal/us
//change them to objects blobs
var wishesBlob = UrlFetchApp
.fetch(wishes_imageURL)
.getBlob()
.setName("wishesBlob");
var nielsenBlob = UrlFetchApp
.fetch(nielsen_imageURL)
.getBlob()
.setName("nielsenBlob");
//for every employee that the 4rth column is true(has_birthday) send email to his/her email address
for (var i =startRow ; i <= lastRow; i++) {
//take info about if the birthday mail has been send before to the employee
emailSend = sheet.getRange(i, 6).getValue();
//whoever has birthday and havent get email before send him/her mail
if((sheet.getRange(i, 5).getValue() == true) && (emailSend !="TRUE") && (timeStamp == sheet.getRange(1, 7).getValue())){
recipient = sheet.getRange(i, 4).getValue();
MailApp.sendEmail(sheet.getRange(i, 4).getValue(),
"",
"BirthDay Wishes",
{ htmlBody:"<h3 style='text-align:center; color:blue;'><i>" + "Για τα γενέθλιά σου ευχόμαστε ολόψυχα Χρόνια Πολλά και κάθε προσωπική και επαγγελματική επιτυχία!" +
"</i></h3>" + "<center><img src='cid:wishes' style='width:500px; height:450px; align:center; position:relative; '/></center>" + "\n" +
"<h3 style = 'text-align:center;color:blue;'>" + "Βίκη – Σπύρος &" +"\n" + "Δ/νση Ανθρώπινου Δυναμικού" + "</h3>" + "\n"
+ "\n\n\n\n"+ "<center><img src='cid:nielsen'/></center>",
inlineImages:
{
wishes: wishesBlob,
nielsen: nielsenBlob
}
});
//after we sent the mail we "lock" this emplyee for the current year
sheet.getRange(i,6).setValue("TRUE");
}
}
我檢查執行成績單和它不顯示在郵件的sent.But如果我使用像這樣它的工作原理
MailApp.sendEmail("[email protected]", // to
"[email protected]", // from
"Your Subject Goes Here", // email subject
"What ever you want to say"); // email body
能否請你幫我......?在此先感謝