gpt4 book ai didi

java - 执行成功,但没有结果?

转载 作者:行者123 更新时间:2023-11-30 08:10:00 25 4
gpt4 key购买 nike

所以,我正在努力为 Google 表单创建此审批工作流程。我对此很陌生,我在网上搜索并阅读了一些教程以及谷歌的教程,但我看到的大部分内容都已被弃用。我认为我的触发器处于当前状态,它们设置为 onformsubmit,当我检查执行日志时,它表示成功。但是,我仍然没有收到任何电子邮件。有人能引导我走向正确的方向吗?

谢谢!

  function sendEmail(e){
var requestorEmail = e.values[1];
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/AKfycbwKtqBa7L_oB2qnkQclVmKuWLnxj6ic74CAalUmxEDCv0SkjCY/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>please review</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 aprovalResponce = (e.parameter.approval == 'true') ? 'Approved.' : 'Sorry, you need to reschedule';

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

var replyEmail = e.parameter.reply;
Logger.log(replyEmail);

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

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


return app;
}

这是我的执行记录

 [15-05-28 11:24:54:243 CDT] SpreadsheetApp.getActiveRange() [0 seconds]
[15-05-28 11:24:54:243 CDT] Range.getRow() [0 seconds]
[15-05-28 11:24:54:243 CDT] Range.getLastRow() [0 seconds]
[15-05-28 11:24:54:243 CDT] Range.getColumn() [0 seconds]
[15-05-28 11:24:54:244 CDT] Range.getLastColumn() [0 seconds]
[15-05-28 11:24:54:244 CDT] SpreadsheetApp.getActiveSpreadsheet() [0 seconds]
[15-05-28 11:24:54:283 CDT] Starting execution
[15-05-28 11:24:54:713 CDT] MailApp.sendEmail(i removed personal info) [0.425 seconds]
[15-05-28 11:24:54:714 CDT] Execution succeeded [0.426 seconds total runtime]

电子邮件当前正在运行,但现在当我在电子邮件中单击“批准”时,我遇到了此错误。有什么想法吗?

[15-05-28 16:19:46:941 CDT] Starting execution
[15-05-28 16:19:46:965 CDT] UiApp.createApplication() [0.001 seconds]
[15-05-28 16:19:46:967 CDT] Logger.log([undefined, []]) [0 seconds]
[15-05-28 16:19:46:968 CDT] MailApp.sendEmail([undefined, Approval Request, Your manager said :Sorry, you need to reschedule]) [0 seconds]
[15-05-28 16:19:46:992 CDT] Execution failed: Invalid email: undefined (line 52, file "Code", project "Send emails") [0.006 seconds total runtime]

最佳答案

即使您肯定会从表单中收到所需的电子邮件,请尝试“硬编码”和电子邮件,并查看 MailApp.sendEmail() 函数是否有效:

MailApp.sendEmail('email@gmail.com", "Approval Request", "what no html?", {htmlBody: html});

在这行代码之后:

var SupervisorsEmail = e.values[2]; //manager e-mail

输入Logger.log()语句:

var SupervisorsEmail = e.values[2]; //manager e-mail
Logger.log('SupervisorsEmail: ' + SupervisorsEmail);

然后提交表单,并在“查看”菜单和“日志”下查看。您收到电子邮件了吗?

此外,请查看“已发送”文件夹,查看是否有电子邮件已发送但从未收到。

关于java - 执行成功,但没有结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30512606/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com