iEhohs DokuWiki

主にプログラミングなど情シス業務の備忘録です

ユーザ用ツール

サイト用ツール


gas:gmail:get-message

Gmailの受信メールを検索して取得する

const query = 'ほげ';   // 検索する文字列
const start = 0;        // 開始番号
const max = 10;         // 取得数
 
const threads = GmailApp.search(query, start, max);
const messagesForThreads = GmailApp.getMessagesForThreads(threads);
 
for(const messages of messagesForThreads){
    console.log(messages[0].getSubject());
    console.log(messages[0].getPlainBody());
}
スポンサーリンク
gas/gmail/get-message.txt · 最終更新: 2023/10/24 20:09 by Shohei Okuda