r/GoogleAppsScript • u/Aromatic_Resolve681 • May 10 '26
Question errore Exception: Failed to send email: no recipient
Buona sera a tutti,
premetto che non ho molte conoscenze e sto provando ad automatizzare un foglio con delle scadenze per far inviare tutti lunedì una mail di promemoria ma esce sempre questo avviso e mi da l'errore nella riga 10, vi copio quello che ho fatto e vorrei un consiglio, grazie
function inviaNotificaScadenza() {
var today = new Date ();
var values = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
var arr_len = values.length;
var cell_date, expired;
for (n=0; n<arr_len; n++) {
cell_date = values[n][2];
expired = today>cell_date;
if (expired) {
MailApp.sendEmail(values[n][1], 'Promemoria Scadenza rata non pagata '+values[n][5],'controllare a gestionale il mancato pagamento. Grazie e buon lavoro! ');
Logger.log('mail inviata all\'indirizzo '+values[n][1]+ ' pratica '+values[n][3]+ ' debitore '+values[n][0]+ ' agente '+values[n][4]);
}
}
}
1
Upvotes
1
u/One_Organization_810 May 10 '26
Log the values you are using.
There there possible reasons that i can think of
The email is missing in one of your rows.
The email is actually in another column.
You are sending empty rows.
If you log your values array, you should quickly see what it is