How to access date/time of emails using appscript

前端 未结 1 1593
無奈伤痛
無奈伤痛 2021-01-23 09:00

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

相关标签:
1条回答
  • 2021-01-23 09:52

    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.

    0 讨论(0)
提交回复
热议问题