GmailApp.sendEmail()将自定义“发件人”添加到电子邮件正文

时间:2019-05-22 20:39:05

标签: google-apps-script

我从Google脚本获得了此代码,每次有人为公司提交表格时,我都会用它向同事发送通知。

  File "U:/FAHAD UL HASSAN/Python Code/Jawad New/PFNN.py", line 225, in <module>
    precision_recall_fscore_support(y_test, score)

  File "C:\Users\fhassan\anaconda3\lib\site- 
packages\sklearn\metrics\classification.py", line 1031, in 
precision_recall_fscore_support
    y_type, y_true, y_pred = _check_targets(y_true, y_pred)

  File "C:\Users\fhassan\anaconda3\lib\site- 
packages\sklearn\metrics\classification.py", line 71, in _check_targets
    check_consistent_length(y_true, y_pred)

  File "C:\Users\fhassan\anaconda3\lib\site- 
packages\sklearn\utils\validation.py", line 235, in 
check_consistent_length
    " samples: %r" % [int(l) for l in lengths])

ValueError: Found input variables with inconsistent numbers of samples: [537, 2]

到目前为止,工作情况很好,但是当我在“来自”字段中收到电子邮件时,会收到表单创建者的电子邮件,我想在其中放置用户名

目前,他们收到这样的电子邮件

function LeadNotifier(e) {

 var values = e.values;
  var htmlBody = '<div background:#E5E8E8;><h2 style="color:#154360;">MENSSAJE WEB <h2><ul>';
  for (var i=0; i < values.length; i++) {

    var data = values[i];
    var replyto = values[2];
    htmlBody += '<li>' + ": " + data + '</li>';

  };
  htmlBody += '</ul><h3 ><strong style="color:green;" >Web Site:</strong> company name </h3></div>';
  GmailApp.sendEmail('dev@mycompany.com','QUOTE REQUEST','',{htmlBody:htmlBody,replyTo: replyto});



}

我需要像这样

|  subject     |        from          |    
|QUOTE REQUEST | form_admin@gmail.com |       

y检查了Documents,发现了一个名为“ from”的参数,但是当我使用它时,却出现了这个错误。

|  subject     |        from          |    
|QUOTE REQUEST |     jhon Doe         | 

所以我认为我以错误的方式使用它

ERRORInvalid argument: Arya Stark  at LeadNotifier(Code:13)

我做错了什么?

2 个答案:

答案 0 :(得分:1)

GMailApp仅允许您使用自己的电子邮件地址或与您的帐户关联的别名地址。这是为了通过将其他人的地址放在from字段中来防止其他人的行为。

答案 1 :(得分:0)

我需要查看您的数据。

这可以帮助您找出答案:

Folder [name=rootf, type=system, path=Parsing/rootf
, children=[Folder [name=f1, type=folder, path=Parsing/rootf/f1
, children=[Folder [name=subf1, type=folder, path=Parsing/rootf/f1/subf1
, children=[Folder [name=text1.txt, type=file, path=Parsing/rootf/folder1/subf1/text1.txt
, children=null, file=[a, b, c]]], file=null], Folder [name=subf2, type=folder, path=Parsing/rootf/f1/subf2
, children=null, file=[]], Folder [name=text2.txt, type=file, path=TParsing/rootf/f1/text2.txt
, children=null, file=[d, e, f]]], file=null], Folder [name=text1.txt, type=file, path=Parsing/rootd/text1.txt
, children=null, file=[aa, bb]]], file=null]