I'm trying to catch email delivery failure in an app script. I thought surrounding MailApp.sendEmail in a try catch would work like so:
function headache(){
Logger.log("Before Try");
try{
Logger.log("before sendEmail");
MailApp.sendEmail("ThisAFake@email.address", "Ima Error", "");
Logger.log("after sendEmail");
}catch(err){
Logger.log("In catch");
MailApp.sendEmail("ThisAReal@email.address", "Ima catched Error", "");
}
Logger.log("After Try");
}
but this is the output im getting:
Before Try
before sendEmail
after sendEmail
After Try
Is there a way to catch mail send failures?