【问题标题】:Google Form Email Notification On Submission提交时的 Google 表单电子邮件通知
【发布时间】:2014-07-14 22:12:18
【问题描述】:

我正在尝试更新此脚本以允许我更新“发件人”或“回复”电子邮件地址。我不确定如何执行此操作,因为我正在使用此处列出的脚本 - http://www.labnol.org/?p=20884

我已向此脚本的开发人员发送了电子邮件,但尚未收到回复。关于添加字段以覆盖默认的“回复”或发件人电子邮件地址的任何建议?

感谢您的帮助!

/* Send Google Form by Email v2.0 */
    /* For customization, contact the developer at amit@labnol.org */
    /* Tutorial: http://www.labnol.org/?p=20884 */
    function Initialize() {
    var triggers = ScriptApp.getScriptTriggers();
    for(var i in triggers) {
    ScriptApp.deleteTrigger(triggers[i]);
    }
    ScriptApp.newTrigger("SendGoogleForm")
    .forSpreadsheet(SpreadsheetApp.getActiveSpreadsheet())
    .onFormSubmit()
    .create();
    }
    function SendGoogleForm(e)
    {
    try
    {
    // You may replace this with another email address
    var email = "CLIENT EMAIL ADDRESS";
    // Optional but change the following variable
    // to have a custom subject for Google Form email notifications
    var subject = "Form Application Submitted";
    var s = SpreadsheetApp.getActiveSheet();
    var columns = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
    var message = "";
    // Only include form fields that are not blank
    for ( var keys in columns ) {
    var key = columns[keys];
    if ( e.namedValues[key] && (e.namedValues[key] != "") ) {
    message += key + ' :: '+ e.namedValues[key] + "\n\n";
    }
    }
    // This is the MailApp service of Google Apps Script
    // that sends the email. You can also use GmailApp for HTML Mail.
    MailApp.sendEmail(email, subject, message);
    } catch (e) {
    Logger.log(e.toString());
    }
    }

【问题讨论】:

    标签: email google-apps-script google-forms


    【解决方案1】:

    替换

    MailApp.sendEmail(email, subject, message);
    

    GmailApp.sendEmail(email, subject, message, {replyTo: "abc@example.com", from: "xyz@example.com"});
    

    发件人地址必须是别名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-23
      • 2016-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-10
      • 2013-08-15
      相关资源
      最近更新 更多