【问题标题】:Link in Email to a Google URL not working在电子邮件中链接到 Google URL 不起作用
【发布时间】:2015-06-01 17:10:55
【问题描述】:

我正在尝试使用 Google 表单创建一个简单的工作流程,它会发送一封自动电子邮件以供批准。

function sendEmail(e){
  var requestorEmail = e.values[1];
  Logger.log('replyEmail: ' + requestorEmail);
  var SupervisorsEmail = e.values[2]; //manager e-mail
  var ApplicationID = e.values[3];
  var ApplicationDate = e.values[4]; //dateconfirmationSent
  var ApplicantName = e.values[5]; //interpreter name
  var MBO = e.values[6];
  var Processor = e.values[7];
  var ShortReason = e.values[8];
  var ReasonCode = e.values[9];
  var approval = e.values[10];  //the one we need to modify
  var url ='https://script.google.com/a/macros/bbva.com/s/AKfycbz5GL9xxSmRcDjUFRJdn4qw7TrfaWNUFD8XwHNlqsCxNPRpOd49/exec';


  /**might be that the & needs to be a ?*/
  var approve = url + '?approval=true'+'?reply='+requestorEmail;
  var reject = url + '?approval=false'+'?reply='+requestorEmail;

  var html = "<HTML><body>"+
           "<h2>Pend Request</h2><br />"
  +"<P>" + ApplicationID +"  " + ApplicationDate
  +"<p>" + "MBO: "+ MBO  
  +"<p>" + "Processor: " + Processor
  +"<p>" + "Short Reason: "+ ShortReason
  +"<p>" + "requester: "+ requestorEmail
  +"<p>" + "Reason Code: "+ ReasonCode+ "  "+
   "<p>"+

   "<a href="+ approve +">Approve</a><br />"+
   "<p>"+

   "<a href=" +reject+">Reject</a><br />"+
          "</HTML></body>";

  MailApp.sendEmail(SupervisorsEmail, "Approval Request", "what no html?", {htmlBody: html});

  }

function doGet(e) {

 var app = UiApp.createApplication();
 var requestorEmail = e.values[1];
  Logger.log('replyEmail: ' + requestorEmail);

 var aprovalResponce = (e.parameter.approval == 'true') ? 'Approved.' : 'Sorry, your request has been denied.';

  var msg = "Your manager said :" + aprovalResponce;

  //var replyEmail = e.values[1];
 //Logger.log(replyEmail);

  MailApp.sendEmail(requestorEmail, "Approval Request", msg);

  var helloWorldLabel = app.createLabel(msg);
  app.add(helloWorldLabel);


  return app;
}

当我运行实际程序时,一切正常。但是当我收到电子邮件时,无论我单击批准还是拒绝,我都会收到“无效电子邮件:未定义”错误。我是 GAS 新手,研究了很多教程、示例等。但由于最近进行了重大更改,因此很少有帮助。

【问题讨论】:

    标签: html user-interface google-apps-script google-apps google-forms


    【解决方案1】:

    尝试将 URL 中的第二个问号更改为 & 符号。你现在拥有的:

    var approve = url + '?approval=true'+'?reply='+requestorEmail;
    var reject = url + '?approval=false'+'?reply='+requestorEmail;
    

    变化:

    +'?reply='
    

    收件人:

    +'&reply='
    

    【讨论】:

    • 你又修好了!谢谢!
    猜你喜欢
    • 2016-12-04
    • 2013-08-05
    • 2014-06-11
    • 1970-01-01
    • 1970-01-01
    • 2011-03-26
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    相关资源
    最近更新 更多