Q: App Script Google Sheet automatic email send - no recipient I have used the following functions to send out automatic emails to my google sheet email list. I've created a html template 'autoresponder' for this.
After setting up triggers for 'onChange' when a row is added the scripts fire but I get the error: Exception: Failed to send email: no recipient
at sendUser(autosend:21:11)
If I run the scripts in the editor, they work fine and the email ist sent out. The trigger is set to run 'onChange' with the deployed script as web App.
The google sheet looks as follows:
Column A: email (with the list of emails)
Column B: name
Column C: status
Any help appreciated,
thanks
function checkdata() {
  const row = SpreadsheetApp.getActiveSheet().getActiveCell().getRow();
  const data = SpreadsheetApp.getActiveSheet().getRange("sheet1!A2:B").getValues()[0];
  Logger.log(row);
  const user = {
    email: data[0]
    , name: data[1]
    , row: row
  };
  Logger.log(user);
  if (user.status != "sent") {
    sendUser(user);
  }
  Logger.log(row);
}

function sendUser(user) {
  const temp = HtmlService.createTemplateFromFile('autorepsonder');
  temp.user = user;
  const message = temp.evaluate().getContent();
  MailApp.sendEmail({
    to: user.email, 
    subject: 'Confirmation registration', 
    htmlBody: message
  });
  SpreadsheetApp.getActiveSheet().getRange(user.row, 3).setValue('sent');
}



A: Try this:
function checkdata() {
  const row = SpreadsheetApp.getActiveSheet().getActiveCell().getRow();
  const data = SpreadsheetApp.getActiveSheet().getRange("sheet1!A2:B").getValues()[row - 1];
  Logger.log(row);
  const user = {
    email: data[0]
    , name: data[1]
    , row: row
  };
  Logger.log(user);
  if (user.status != "sent") {
    sendUser(user);
  }
  Logger.log(row);
}

