I was following this post to create an image from a spreadsheet keeping the same color and format to be sent as an email.
Now while I try to send the email as "cc" or "bcc", I get back an error that says "Invalid email: [L;@34c5bdeb (line 34, file "Send Email")". All the emails that I'm using are working, comma-separated and without any symbol. If I use the same emails as "To" they work great; I don't know what the error could be.
var image = SheetConverter.convertRange2html(rng);
var HTML = "Team," +
"<br/><br/>Below you will find the summary for the Overview of the Billing files." +
"<br/><br/>" + msg +
"<br/><br/>" + image +
"<br/><br/>Best regards,";
return HTML;
}
function doGet() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('ALERTS');
var EmailSettings = ss.getRange('E5:E9').getValues(); // getting information for the email to be sent
var EmTo = EmailSettings[0];
var emailcc = EmailSettings[1];
var emailbcc = EmailSettings[2];
var EmSubject = EmailSettings[3];
var EmMessage = EmailSettings[4];
var dataRange = ss.getRange('A1:B22'); //Range to be converted into an image
var HTML = convSheetAndEmail(dataRange, EmMessage);
var options = {
name: "TEST EMAIL GROUP",
htmlBody: HTML,
cc:emailcc,
bcc:emailbcc
};
Email(EmTo, EmSubject, options);
}
function Email(email, subject, options) {
MailApp.sendEmail(email, subject, '', options);
}