Skip to content

Instantly share code, notes, and snippets.

Created January 11, 2012 10:30
Show Gist options
  • Save anonymous/1594075 to your computer and use it in GitHub Desktop.
Save anonymous/1594075 to your computer and use it in GitHub Desktop.
Google表單自動寄信Script
function sendMails(e) {
// 獲取時間戳記
var timestamp = e.values[0];
// 得到第一個欄位的值,在這個範例中,我們可取得「姓名」。
var name = e.values[1];
// 得到第二個欄位的值,在這個範例中,我們可取得「EMail位址」。
var mail = e.values[2];
/* 設定寄件內容,Mail.App.sendEMail()這個函式,
第一個參數為「EMail位址」,第二個參數為「標題」,第三個參數為「內容」。
以這個範例而言,我設定標題為 "表單測試: 使用者名稱",內容為"姓名:xxx submitted by Allen"
*/
MailApp.sendEmail(mail, "表單測試:"+name,
"姓名:" + name + " submitted by Allen.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment