简体   繁体   English

Google Apps脚本-检查电子邮件是否已正确发送

[英]Google Apps Script - check if an email has sent properly

I'm working on a Google Apps Script project that sends an email when a button is clicked on a HTML sidepanel I've built. 我正在研究一个Google Apps脚本项目,当我在构建的HTML侧面板上单击按钮时,该项目会发送电子邮件。 Currently the script works as planned and fires off an email when told, but I'm wondering if there's any way that it could check that the email sent correctly so I can notify the user that it's ok to close the tab? 目前,该脚本按计划工作,并在收到提示时触发电子邮件,但是我想知道是否有任何方法可以检查电子邮件是否正确发送,以便通知用户可以关闭选项卡?

Thanks in advance 提前致谢

If you are using the Gmail API to sending email, it will return the ID of the email that you can use to trace the email in your mailbox. 如果您使用Gmail API发送电子邮件,它将返回可用于跟踪邮箱中电子邮件的电子邮件ID。

Google Script stores a copy of every sent email in the Gmail sent items folder. Google脚本将每个已发送电子邮件的副本存储在Gmail已发送邮件文件夹中。 If you are using the GmailApp service, search the sent items for a copy of the email. 如果您使用的是GmailApp服务,请在发送的邮件中搜索电子邮件的副本。 If found, it was sent. 如果找到,则发送。

GmailApp.search("in:sent to:email@domain.com after:epoch_time")

You can use epoch time in Gmail search to find emails that were sent in the last minute or so. 您可以在Gmail搜索中使用纪元时间来查找最近一分钟左右发送的电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM