我正在尝试在应用脚本中捕获电子邮件传递失败。我认为在 try catch 中围绕 MailApp.sendEmail 会像这样工作:
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");
}
但这是我得到的输出:
Before Try
before sendEmail
after sendEmail
After Try
有没有办法捕捉邮件发送失败?