GAS(GoogleAppScript)にて、重要メールを通知するサンプルを紹介します。
GAS 重要メールを通知するサンプル
function noticeImportantMeil() {
var rule = '検索条件'; // 任意の検索条件を指定
var unreadCnd = rule + " is:unread";
var threads = GmailApp.search(unreadCnd, 0, 200);
var msgs = GmailApp.getMessagesForThreads(threads);
// 最新メッセージを取得
latestMsgs = msgs.map(m => m[m.length - 1]);
// 何らかの方法で通知
// latestMsgs.forEach(lm => notice(lm));
// 対象メールを既読にする
GmailApp.markThreadsRead(threads);
}