I have to send an email to an address that is chosen from a dropdown menu in google sheets. When I do sh.getRange("C15").getValue(); it just doesn't send an email to it. It works with any other cell but this one with a dropdown menu.
function sendEmail() {
var sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Porudžbenica')
var imeKupca = sh.getRange('C5');
var kupac = imeKupca.getValue();
var mailRange = sh.getRange('C14');
var mail = mailRange.getValue();
var cc1 = sh.getRange("C15").getValue();
var cc2 = sh.getRange("C16").getValue();
//var location1 = sh.getRange('J37');
//var location2 = sh.getRange('J38');
//location1.setValue(cc1);
//location2.setValue(cc2);
var ccA = [cc1];
var ccB = [cc2];
MailApp.sendEmail({to:'example@email.com', cc:mail, ccA, ccB,
subject: 'Porudžbina ' + kupac,
htmlBody: testTableHTML()})
};
If anyone god forbid encounters this, putting one email in bcc should do the trick
function sendEmail() {
var sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('YourSheet');
var imeKupca = sh.getRange('C5');
var kupac = imeKupca.getValue();
var mailRange = sh.getRange('C14');
var mail = mailRange.getValue();
var cc1 = sh.getRange("C15").getValue();
var cc2 = sh.getRange("C16").getValue();
MailApp.sendEmail({to:'example@email.com', cc:cc1, mail, bcc: cc2, //putting cc2
//as bcc somehow does the trick, it's probably bugged and will get fixed tho.
subject: 'Porudžbina ' + kupac,
htmlBody: testTableHTML()})
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.