After attempting to execute this particular script, I am encountering an issue where no emails are being sent to the user's email address. The functionality of the script involves comparing values in a specific column in a sheet (column 10) and sending an email with the differentiated content when the user selects options 1, 2, or 3. Please see the code snippet below:
function mutisendemail(e) {
if (e.values[10] == "1") {
var useremail = "<a href='/cdn-cgi/l/email-protection' class='__cf_email__' data-cfemail='1561706661557278747c793b767c793b'>[email protected]</a>";
var subject = "test1";
var body = "number 1 ";
var photo = DriveApp.getFilesByName('test1.jpg');
MailApp.sendEmail({
to: userEmail,
subject: subject,
body: body,
attachments: [photo.next()]
});
}
if (e.values[10] == "2") {
var useremail = "<a href='/cdn-cgi/l/email-protection' class='__cf_email__' data-cfemail='6a1e0f191e2a0d070b030644090507'>[email protected]</a>";
var subject = "test2";
var body = "number2";
var photo = DriveApp.getFilesByName('test1.jpg');
MailApp.sendEmail({
to: userEmail,
subject: subject,
body: body,
attachments: [photo.next()]
});
}
if (e.values[10] == "3") {
var useremail = "<a href='/cdn-cgi/l/email-protection' class='__cf_email__' data-cfemail='fe8a9b8d8abe99939f9792d09d91'>[email protected]</a>";
var subject = "test3";
var body = "number3";
var photo = DriveApp.getFilesByName('test1.jpg');
MailApp.sendEmail({
to: userEmail,
subject: subject,
body: body,
attachments: [photo.next()]
});
}
}