sendEmails runs but does not work

0

First of all, take it easy with me, I'm starting HAHAHA

I wrote this script here, debuggei it, no error ... but when I put it to run, it does not send the email, nor mark "Yes" in the last column.

Where did I go wrong?

function mailing(){

    var emailQuotaRemaining = MailApp.getRemainingDailyQuota();

    var ss = SpreadsheetApp.getActiveSpreadsheet();
    ss.setActiveSheet(ss.getSheetByName("Autorização"));
    var sheet = SpreadsheetApp.getActiveSheet();
    var dataRange = sheet.getDataRange();
    var data = dataRange.getValues();
    for (var i = 1; i < data.length; ++i)
    {
        var rowData = data[i];

        var emailDocente = rowData[0];
        var dataHora = rowData[1];
        var numeroAutorizacao = rowData[2];
        var inicio = rowData[3];

        // vars irrelevantes

        var nomeExt = rowData[16];
        var observ = rowData[17];
        var emailSent = rowData[18];

        if (emailSent = "") {   
            var assunto = "Autorização NATEPE Nº " + numeroAutorizacao + " (" + nomeAluno + ")";
            var corpo = "" // Dado irrelevante, texto longo  

            MailApp.sendEmail({
                to: emailDocente,
                replyTo: "l***[email protected]",
                subject: assunto,
                message: corpo,
                cc: "l***[email protected]"});

            sheet.getRange(startRow + i,18).setValue("Sim");

            SpreadsheetApp.flush();
        }
    }
}
    
asked by anonymous 28.07.2018 / 05:49

0 answers