在Google Apps脚本MailApp.sendEmail中使用cc和/或bcc [英] Use of cc and/or bcc in google apps script MailApp.sendEmail

查看:176
本文介绍了在Google Apps脚本MailApp.sendEmail中使用cc和/或bcc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Google Apps脚本中运行以下脚本(emailAddress是从工作表中提取的变量):

I am running the following script in Google apps script (emailAddress is a variable pulled from a sheet):

MailApp.sendEmail(emailAddress, subject, message,{htmlBody:message});

我正在尝试为此添加cc和/或bcc字符串,但是当我这样做(并且我使用正确的格式)时,我遇到一个一致的错误,即这样做时有太多的字符串.

I am trying to add a cc and/or bcc string to this, but when I do so (and I using the correct format) I am getting a consistent error that there are too many strings when I do so.

MailApp.sendEmail是否仅限于四个字符串?我使用{htmlBody:message}是问题吗?通过消除这一点,我能够部分实现我想做的事情,但是我的目标是发送html电子邮件并将该电子邮件复制到内部地址,以便我的所有工作人员都可以看到已发送的电子邮件,而不仅是发件人.

Is MailApp.sendEmail limited to only four strings? Is my use of the {htmlBody:message} the problem? I was able to partially achieve what I am trying to do by eliminating this, but my goal is to send an html email out and copy that email to an internal address so all my staff can see the sent email, rather than only the sender.

另一个问题是我不需要以下内容

Another issue is that I do not want the following

var emailSent = row[5];
if (emailSent != "EMAIL_SENT")

要在抄送和/或密件抄送的电子邮件上进行操作,否则我的源工作表将为每封电子邮件包含两个EMAIL_SENT条目.

to operate on the cc'd and/or bcc'd email or my source sheet will include two EMAIL_SENT entries for every email.

有解决方案吗?

推荐答案

请尝试以下操作:

MailApp.sendEmail(emailAddress, subject, message, {
  htmlBody: message,
  cc: 'internal1@email.com',
  bcc: 'internal2@email.com'
});

这里还有其他可用参数:

There are other parameters also available check here : https://developers.google.com/apps-script/reference/mail/mail-app#sendemailrecipient-subject-body-options

这篇关于在Google Apps脚本MailApp.sendEmail中使用cc和/或bcc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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