😽
Gmailのスター以外のメールを削除するGAS
gmail削除gs
function myFunction() {
[...Array(5)].map((_, cnt) => {
deleteMail(cnt);
})
}
function deleteMail(cnt) {
const query = '-is:starred';
const threads = GmailApp.search(query);
for (let i = 0; i < threads.length; i++) {
if (threads[i]) {
console.log(`${cnt}-${i}`, threads[i].getMessages()[0].getSubject())
threads[i].moveToTrash();
}
}
}
Discussion