0
我在另一個電子表格中使用了一個腳本,在有人提交表單時通過電子郵件向我發送電子郵件。它會通過電子郵件向我發送一些重要問題的答案,並提供鏈接以查看電子表格上的完整回覆。在表單提交中發送自動應答電子郵件腳本
這是我的作品的原始代碼:
function Outreach_FormMailer(e) {
var recipient = "[email protected]";
var timestamp = e.values[0];
var name = e.values[1];
var subject = e.values[1]+" completed a Report for "+e.values[3]
var dates = e.values[7];
var goalMet = e.values[9]
var goalFocus = e.values[10]
var hyperlink = "myawesomelink.com"
htmlBody = name+' just completed the O/R Report for these dates: '+dates+'<br><br>Form completed on: '+timestamp+'<br>Was the goal met? '+goalMet+'<br>What was the goal focus? '+goalFocus+
'<br><br>View the Form:<a href="'+hyperlink+'">Click Here</a>';
MailApp.sendEmail(收件人,主題,htmlBody,{htmlBody:htmlBody}); }
我想用這個代碼來創建一個帶有不同問題的新表單,所以我編輯了代碼以對應正確的問題。
這是不起作用的代碼:
function Team_ApplicationMailer(e) {
var recipient = "[email protected]";
var timestamp = e.values[0];
var name = e.values[3];
var subject = e.values[1]+' filled out the Teams Application Form!' ;
var startdate = e.values[12];
var enddate = e.values[13]
var Focus = e.values[19]
var hyperlink="myawesomelink.com"
htmlBody = name+' from: '+e.values[1]+'just completed the Teams Application Form for these dates: '+startdate+' to '+enddate+'<br><br>Form completed on: '+timestamp+'<br><br>View the Form:<a href="'+hyperlink+'">Click Here</a>';
MailApp.sendEmail(recipient, subject, htmlBody, {htmlBody:htmlBody});
}
我已經做了一些測試電子郵件,由於某些原因,這個版本的腳本將無法工作。我將這個腳本添加到已經在電子表格中有回覆的表單上。這會有所作爲嗎?真的不知道我在將代碼傳輸到其他電子表格時做了什麼錯誤。
您是否使用記錄器檢查過該函數是否被調用,並且這些值與它們應該具有的值相對應?你是否收到錯誤信息或者什麼都沒有發生? – 2013-02-13 10:16:55
爲腳本配置觸發器(資源>當前項目的觸發器)時,觸發器右側是Notifications,它會打開一個對話框來設置失敗通知。我總是會立即通知我。通常,當執行抄本沒有顯示任何內容時,該電子郵件會提供我正在查找的信息。 – bigelowr 2013-02-15 20:26:18