捕获MailApp.sendEmail传递失败

时间:2013-03-11 21:24:25

标签: google-apps-script

我正试图在应用脚本中捕获电子邮件传递失败。我认为在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

有没有办法捕获邮件发送失败?

1 个答案:

答案 0 :(得分:3)

电子邮件发送延迟,无法捕获此错误。