如何使用appscript访问电子邮件的日期/时间 [英] How to access date/time of emails using appscript

查看:149
本文介绍了如何使用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)
      });
    });
    

    • The information of getDate() is here
    • The information of getInboxThreads() is here

    If I misunderstand your question, I'm sorry.

    这篇关于如何使用appscript访问电子邮件的日期/时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆