如何使用appscript访问电子邮件的日期/时间 [英] How to access date/time of emails using appscript
问题描述
我在看我的收件箱,我可以看到电子邮件被记录的时间,但我无法查看如何获取电子邮件的日期/时间,尽管查看了apps脚本gmail API( https://developers.google.com/apps-script/reference/gmail/gmail-app?hl=ja#detailed-documentation )
可以这样做吗?
下面的示例如何?您可以使用 getDate()
检索每个电子邮件的日期。示例脚本如下。
示例脚本:
var threads = GmailApp.getInboxThreads(0,50);
threads.forEach(function(messages){
messages.getMessages()。forEach(function(msg){
var date = msg.getDate(); // date / time
var body = msg.getBody(); // mail
Logger.log(date)
Logger.log(body)
});
});
-
getDate() code>是此处
-
getInboxThreads()
的信息是这里 误解你的问题,对不起。
I'm looking at my inbox and I can see the time of the email is being recorded, but I'm having trouble seeing how to grab the date/time of an email, despite looking at the apps script gmail API (https://developers.google.com/apps-script/reference/gmail/gmail-app?hl=ja#detailed-documentation)
Can this be done?
How about a following sample? You can retrieve date for each e-mail using getDate()
. The sample script is as follows.
Sample script :
var threads = GmailApp.getInboxThreads(0, 50);
threads.forEach(function(messages){
messages.getMessages().forEach(function(msg){
var date = msg.getDate(); // date/time
var body = msg.getBody(); // mail
Logger.log(date)
Logger.log(body)
});
});
If I misunderstand your question, I'm sorry.
这篇关于如何使用appscript访问电子邮件的日期/时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!