LoginSignup
9
9

More than 5 years have passed since last update.

Google Apps ScriptでGmailの操作

Posted at

気づいたことをメモしていく

参考

スクリプト例

受信箱のメール検索

  • 受信箱から指定された文字列をタイトルに含むメールを検索し、最終受信日時と一緒にログに出力
function search() {
  var searchString = "探したいメール";
  var threads = GmailApp.getInboxThreads();
  for (var i = 0; i < threads.length; i++) {
    var subject = threads[i].getFirstMessageSubject();
    if( subject.indexOf(searchString ) == -1 ){
      continue;
    }
    var lastDateStr = Utilities.formatDate( threads[i].getLastMessageDate(), "Asia/Tokyo", "yyyy/MM/dd HH:mm:ss" );
    Logger.log(subject + "," + lastDateStr);
  }
}

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9