2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Amazonで買った時のGmailを自動で既読にする

Posted at

#Why to make
先日のAmazonプライムデーで買い過ぎました。数十件のGmailの通知が...
1件1件ポチポチと既読つけ、アーカイブ...もうめんどくさい!
※誰かに購入された時に気付かない可能性もあるので、やるなら自己責任でお願いします。

#How to make
GoogleAppsScriptページ開いて、以下ソースコードをコピペ。認証して、トリガーを1分ごとに。必ず入ってる、にっくき"ご注文の確認"を含む未読メールをアーカイブして、既読をつけてます。

.js
function getMail(){

  var FindSubject =  '(is:unread + "ご注文の確認")';
  var myThreads = GmailApp.search(FindSubject, 0, 5);
  var myMessages = GmailApp.getMessagesForThreads(myThreads);
  GmailApp.moveThreadsToArchive(myThreads);

  for(var i in myMessages){
      myMessages[i][0].markRead();
  }
}
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?