Skip to content

Instantly share code, notes, and snippets.

@eriktodx
Last active May 22, 2025 15:43
Show Gist options
  • Save eriktodx/86fb0d95a1801cf0cca16c4e644dfbf4 to your computer and use it in GitHub Desktop.
Save eriktodx/86fb0d95a1801cf0cca16c4e644dfbf4 to your computer and use it in GitHub Desktop.
Script to delete all emails from Proton Mail
/**
* Proton Mail - Delete All Mail Script
*
* This script deletes all mail from Proton Mail by
* clicking Select all messages button, waiting and
* clicking trash button. This is repeated indefinitely.
*
* 1. Open Proton Mail
* 2. Navigate to Settings -> Messages and Composing
* 3. Change Conversation per page to 200
* 4. Open Proton Mail
* 5. Navigate to All mail
* 6. Select page 2
* 7. Open Dev Tools and paste this script
* 8. Watch your emails disappear
*
* Adjust DELAY as needed. Recommended value is 5000 milliseconds.
*/
const DELAY = 5000;
function clickSelectAll() {
try {
document.querySelector("#idSelectAll").click();
} catch (e) {
console.error(e);
}
}
function clickTrash() {
try {
document.querySelector('[data-testid="toolbar:movetotrash"]').click();
} catch (e) {
console.error(e);
}
}
function trashAll() {
clickSelectAll();
setTimeout(() => {
clickTrash();
setTimeout(trashAll, DELAY);
}, DELAY);
}
setTimeout(trashAll, DELAY);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment