Using cc in Gmail.App

316 views
Skip to first unread message

Paul Cook

unread,
Aug 12, 2023, 9:44:06 AM8/12/23
to Google Apps Script Community
Does Gmail.Ap allow an email address to be cc'd in? If so how would I get this to work?

Paul Cook

unread,
Aug 12, 2023, 9:45:42 AM8/12/23
to Google Apps Script Community
I tried this but it doesn't work and just sends to the to email which is recipient

//Create function to send email with link to gsheet on regular basis
  function sendUpdateEmail() {

//include link to sheet within ''

//include recipient email addresses within '' separated by ,
  var recipients = 'email';
  var cc = 'email';
  var subject = 'This is a test email to automate sending gsheets';
  var body = 'Dear all,\n\nThis is a test email to automate sending gsheets:\n\n' + sheetUrl + '\n\nThank you!\n\nKind regards,\nPaul';
 
// Send email to recipients
  GmailApp.sendEmail(recipients, cc, subject, body);
}

Scott Bennett

unread,
Aug 12, 2023, 10:24:32 AM8/12/23
to google-apps-sc...@googlegroups.com
Here is the documentation. 
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/33312e93-29dc-47f5-87c4-693ffa990f46n%40googlegroups.com.

cbmserv...@gmail.com

unread,
Aug 12, 2023, 2:41:10 PM8/12/23
to google-apps-sc...@googlegroups.com

Try this:

 

     GmailApp.sendEmail(recipients, subject, body, {cc: cc});

--

Paul Cook

unread,
Aug 13, 2023, 7:26:50 AM8/13/23
to Google Apps Script Community
perfect that worked thanks! why does it have to be in {}

CBMServices Web

unread,
Aug 13, 2023, 1:20:49 PM8/13/23
to google-apps-sc...@googlegroups.com
The curly brackets is representing an object which are the options to be used. So inside the brackets you can put all the various options you want to specify. For example if you want to use an html version of the message body, you would then specify it there.

Check out the full list of options you can use from the reference link that was sent to you.


Reply all
Reply to author
Forward
0 new messages