I am trying to send an email, but I get this error.
Exception: Failed to send email: no recipient
The code is as follows
function sendMail(){
const sheet = SpreadsheetApp.getActiveSheet();
const lastRow = 100;
sheet.getLastRow();
const values = sheet.getRange(1, 1, lastRow, 3).getValues();
const doc = DocumentApp.openById('1B3VaUtRu5yEcG57i1sOse9WC2Pd4AZv7Hiq8XqLo5YU');
const docText = doc.getBody().getText();
const subject = '【テスト】【重要なお知らせ】プライバシーポリシーの改定について'; //メールの件名
const options
for(let i = 2; i < lastRow; i++){
const lastName = values[i][0]; //姓
const firstName = values[i][1]; //名
const mailAddress = values[i][2]; //アドレス
const body = docText
.replace('{姓}',lastName)
.replace('{名}',firstName);
GmailApp.sendEmail(mailAddress, subject, body, options);
}
}
I would like to know what needs to be corrected.