Click here to improve your skills! !! [click]

[Google Apps Script] How to set multiple cc / bcc for GMail transmission

GAS(GoogleAppsScript)
This article can be read in about 3 minutes.

GmailApp.sendEmail

Here’s how to send via Gmail.

GmailApp.sendEmail(mailto, subject, body, option)

GmailApp.sendEmail (
Destination address (to), email title, email body,
{
cc: Destination address (cc),
bcc: Destination address (bcc),
from: Source address (from),
noReply: false,
replyTo: reply address (replyTo),
name: From name
})

The value between “{” and “}” is optional and can be added freely.

For example
GmailApp.sendEmail (
“from@exmple.com”,
“[From] test transmission”,
“This is a test email” {
to: to@exmple.com,
cc: cc@exmple.com,
}
)

If so, an email will be sent to to@exmple.com, and cc@exmple.com will be included in cc.

How to set multiple cc / bcc

If you enter “cc:” in the option part and then concatenate with “,” (comma), you will be able to send them together as cc.

{
cc:’mail-1@gmail.com,mail-2@gmail.com, mail-3@gmail.com ‘
}

Only this! Now you can send cc all at once.

When I tested it, it seems that it arrives even if “,” follows the end of the word.

Summary

If you have a list of cc, it’s OK if you connect them with “, (comma)” like “= D2 &”, “& E2 &”, “& F2 …”!

It’s a little trick, but if you know it, you can use it, so please refer to it.
(^ ^)

Copied title and URL