首页 文章

Google电子表格脚本编辑器MailApp.sendEmail没有设置replyTo?

提问于
浏览
2

我正在使用Google电子表格向客户发送评论 . 当他们提交评论时,会通过电子邮件发送给我 . 我用the MailApp.sendEmail method . 除了replyTo "advanced argument"之外,它按预期工作:

var myAdvancedArgs = { htmlBody: myHtmlBody, replyTo: customerEmail };
MailApp.sendEmail("me@example.com", "Comments Form", myBody, myAdvancedArgs);

customerEmail设置正确,因为我在邮件正文中输出正确 . htmlBody工作,因为我得到我的GMail帐户中显示的电子邮件的HTML版本 . 但是,当我点击GMail中的回复按钮时,To:地址就是我自己 . 似乎 replyTo 根本没有设置 . 但是我通过使用工具提示"Show Details"单击我姓名旁边的小三角形查看电子邮件的 Headers ,它确实提到了正确的回复地址:

reply-to:    mycustomer@example.com

MailApp.sendEmail 未正确设置回复标头吗?

UPDATE :我发生了什么事 . reply-to Headers 是不是't set properly (maybe that'不是你怎么回复?)或GMail对我不起作用 .

第一张图片,您会看到我的Google电子表格脚本创建了一个 reply-to Headers :
Email from script with reply-to header set

第二张图片,当我点击GMail中的回复按钮时,地址是 not 填入 reply-to Headers 中的地址:
Bad reply to address

3 回答

  • 0

    我找到了reason to your (and my) problem .

    您看到的是Gmail错误,而不是Apps Script错误 . 基本上,如果回复是您与地址链接的任何电子邮件地址,那么您可以从gmail中以该帐户发送邮件,则忽略回复 . 换句话说,它看起来会破碎,但对于脚本的任何其他用户,它将正常工作 . 非Gmail用户无论如何都会看到它正常运行 .

  • 1

    这是一个老问题,但如果我需要它,也许其他人也需要它!

    From my testing the replyTo worked only when I sent the mail not to the form Acount mail. If your form is on your@gmail.com acount send it to yourOtherMail@gmail.com

    var reply = e.namedValues['Email'];
    
    MailApp.sendEmail("NotFormMail@mail.com", "subject", "message",{"replyTo" : '"'+reply+'"'});
    
  • 1

    刚试过这样的:

    function myFunction() {
        MailApp.sendEmail("serge----@gmail.com ", "test message",'empty body', {"replyTo" : "serge_test@yopmail.com"});   // replyTo son@insas
    }
    

    当我“回复”(使用gmail或任何邮件客户端中的回复按钮)时,它按预期工作,它显示如下:

    enter image description here

    即使确实发送者确实是脚本的作者(这也是预期的行为,请参见documentation about scripts),这确实是 replyTo 地址

    所以我担心issue you raised无效......

相关问题