0
votes

I have a Google Sheet that I want to overlay with a google script. In Column B, I have the addressed to email and in columns C - F I have emails listed of all the individuals who should be cc'd on the email. All of the emails will contain the same message and should be sent on the 1st of each month. Further, the row length should be able to grow in case the email list grows.

Can anyone assist with this? I have this form of code so far, not sure if it is correct.

function sendMail(name){

  var recipients= '[email protected]';
  var subject = 'TEXT';
  var body = 'TEXT'

  MailApp.sendEmail(recipients, subject, body);

}      
1

1 Answers

0
votes

You need to setup a time based trigger to schedule reports. Do note that the function cannot have any parameters so you have to store them separately - in a spreadsheet cell or a property - and access it from your function.

function setTrigger() {
 ScriptApp.newTrigger("sendMail")
   .timeBased()
   .onMonthDay(1)
   .create();
}