Skip to content

Instantly share code, notes, and snippets.

View Aanusha-G's full-sized avatar

Aanusha Ghosh Aanusha-G

  • Cambridge
View GitHub Profile
@dwightmulcahy
dwightmulcahy / emptygmailtrash.js
Last active November 22, 2025 21:55
Google app script to empty the trash. A time out of 5 minutes is built in to avoid the "Function execution has timed out" error if it runs too long.
// ----------------------------
// --- GLOBAL CONFIGURATION ---
// ----------------------------
// Define the list of Gmail folders (labels) to be cleaned.
// To specify a custom label that is nested under another, use a forward slash '/'.
const FOLDERS_TO_CLEAN = ["Trash", "Spam", "My Custom Label"]; // <--- CONFIGURE YOUR FOLDERS HERE
// Define a list of email addresses from which to delete messages.
// If this list is empty, the script will delete messages from ALL senders
// found within the FOLDERS_TO_CLEAN.