Just saw a post about a service that provides, among other things, bulk email deletion on Gmail; but you have to give them access to your account (Yeah, that's a NO for me dog). Coincidentally, not so long ago I was talking to ChatGPT about how to do just that (I reckon that ChatGPT has read every manual and API documentation in existence). Anyways, here's the tutorial that it gave me and that I have tested.<p>Steps:<p>1. Open Google Apps Script (drive.google.com > new > more > Google Apps Scripts)<p>2. Click create scripts.<p>3. Write the Script:<p><pre><code> function deleteOldEmails() {
var threads = GmailApp.search('older_than:1y');
for (var i = 0; i < threads.length; i++) {
threads[i].moveToTrash();
}
}
</code></pre>
This example deletes emails older than one year (older_than:1y). You can modify the search query for different criteria (e.g., label:unread, from:specific@example.com, before:YYYY/MM/DD).<p>4. Save the Script.<p>5. Run the Script:<p>Click the play icon to run the script. It will ask for permissions the first time.<p>This method allows you to automate email management using custom queries.<p>If you want to test the search string - GmailApp.search(...) - to be sure you are deleting the right emails, you can use the filter on the search bar on Gmail.
Thanks, i was trying to download some of emails lately. After slamming some keys i found takeouts manages downloading data throughout google services. But this feels more interesting, i’ll see if i could download them with this!