我嘗試運行此腳本,但未發送任何電子郵件至useremail。當用戶選擇1,2,3和頂點時,這個腳本將比較工作表(第10列)中的值併發送差異電子郵件正文。按照這個腳本發送電子郵件與表中的值進行比較
function mutisendemail(e) {
if (e.values[10] == "1") {
var useremail = "[email protected]";
var subject = "test1";
var body = "number 1 ";
var photo = DriveApp.getFilesByName('test1.jpg');
MailApp.sendEmail({
to: userEmail,
subject: subject,
body: body,
attachments: [photo.next()]
});
}
if (e.values[10] == "2") {
var useremail = "[email protected]";
var subject = "test2";
var body = "number2";
var photo = DriveApp.getFilesByName('test1.jpg');
MailApp.sendEmail({
to: userEmail,
subject: subject,
body: body,
attachments: [photo.next()]
});
}
if (e.values[10] == "3") {
var useremail = "[email protected]";
var subject = "test3";
var body = "number3";
var photo = DriveApp.getFilesByName('test1.jpg');
MailApp.sendEmail({
to: userEmail,
subject: subject,
body: body,
attachments: [photo.next()]
});
}
}
請讓代碼可讀性 - [這](http://jsbeautifier.org/)是一個在線資源,你可以用它來縮進代碼正確 –
顯示在開發商有哪些誤區工具控制檯 –
它顯示TypeError:無法從undefined讀取屬性「值」。 (第2行,文件「測試」) –