MailApp BCC邮件详细信息未显示在已发送文件夹中 [英] MailApp BCC message details not showing in sent folder

查看:167
本文介绍了MailApp BCC邮件详细信息未显示在已发送文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用MailApp发送密件抄送电子邮件时,它会发送,接收并收到电子邮件,并显示在发件人的已发送文件夹中。但是,已发送文件夹中的电子邮件不会向发件人显示密件抄送人通常希望的身份。它显示为已发送给SENDER的电子邮件(即使发件人未将其发送给自己)。

When I send a bcc'd email using MailApp it sends, is recieved, and the email shows up in the sender's sent folder. However, the email in the sent folder does not show the sender who they bcc'd like it normally would. It shows as an email that was sent TO the SENDER (even though the sender did not send it to themself).

此外,它似乎也像在发送邮件合并一样发送电子邮件。它最终显示在密件抄送收件人收件箱中,显示为唯一收件人(不是密件抄送收件人)。

Also, it appears that it is sending the email almost like a mailmerge. It ends up in the bcc recipients inbox showing them as the only recipient (not as a bcc recipient).

这是一个真正的问题,因为您无法验证是否已将电子邮件发送至超过20人。

This is a real concern because you can't verify that you sent your email to 20+ people.

已经有人问过此处,没有答案。

This was already asked here with no answers.

function sendEmail(form) {
  
  var ss = SpreadsheetApp.getActive();
  var body = form.body;
  var bcc = form.bccfield;
  var cc = form.ccfield;
  var to = form.tofield;
  var subject = form.subject;
   var eHandle = ss.getSheetByName("Email Handling");
  var sig = eHandle.getRange(10, 2).getValue();
  var img = eHandle.getRange(11, 2).getValue();    
  var sigImage = '<img src ="' + img + '" >';
  
MailApp.sendEmail(to, {
    to: to,
  cc: cc,
  bcc: bcc,
    subject: subject,
   
  htmlBody: body.replace(/\n/g, '<br>') + sig + sigImage});
  }


推荐答案

使用 GmailApp ,它具有类似的 sendEmail 方法可以完全满足您的需求。您对 MailApp 方法的行为也很正确-电子邮件的发送就像是单独的电子邮件 0

Use GmailApp, it has an analogous sendEmail method that does exactly what you want. You are also correct about the behavior of the MailApp's method - the emails are sent as if they were separate emails0.

要直接查看差异,请运行以下代码段:

To see the difference first-hand, run the following snippet:

function testBcc() {

    const email = Session.getEffectiveUser().getEmail();

    const emailConfig = {
        to: email,
        bcc: email,
        htmlBody: `<p>Test message</p>`,
        subject: "test subject"
    };

    MailApp.sendEmail(emailConfig);
    GmailApp.sendEmail(
        emailConfig.to, emailConfig.subject,
        "",
        { htmlBody: emailConfig.htmlBody, bcc : emailConfig.bcc });
}

请注意,您将需要以下范围:

Note that you will need the following scopes:

https://www.googleapis.com/auth/userinfo.email getEmail
https:// www。 googleapis.com/auth/script.send_mail sendEmail 通过 MailApp
https://www.googleapis.com/auth/gmail.send 通过 GmailApp

0 请注意,您的方法签名确实是不正确的,因为提到了鲁本

0 please note that your method signature is indeed incorrect as Rubén's answer mentions.

这篇关于MailApp BCC邮件详细信息未显示在已发送文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆