本文介绍了捕获MailApp.sendEmail传递失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在应用脚本中捕获电子邮件传递失败.我认为在尝试捕获中将MailApp.sendEmail围绕起来像这样工作:
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("[email protected]", "Ima Error", "");
Logger.log("after sendEmail");
}catch(err){
Logger.log("In catch");
MailApp.sendEmail("[email protected]", "Ima catched Error", "");
}
Logger.log("After Try");
}
但这是输出即时消息:
Before Try
before sendEmail
after sendEmail
After Try
有没有办法捕获邮件发送失败?
Is there a way to catch mail send failures?
推荐答案
电子邮件发送被延迟,无法捕获此错误.
Email sending is deferred and there is no way to catch this error.
这篇关于捕获MailApp.sendEmail传递失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!