Created
February 17, 2026 14:49
-
-
Save leventyalcin/44966cd45e18ae752350bf3dd6226741 to your computer and use it in GitHub Desktop.
Deleting everyhting and emptying inbox in Proton Email is a hassle. This moves everything to Trash. Use only if you understand the consequences
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function deleteAllEmails() { | |
| while (true) { | |
| // Click the label wrapping the select-all checkbox | |
| const label = document.querySelector('label[for="idSelectAll"]'); | |
| if (!label) { console.log('No select-all found. Done.'); break; } | |
| label.click(); | |
| await new Promise(r => setTimeout(r, 1000)); | |
| // Look for trash button | |
| let trashBtn = document.querySelector('[data-testid="toolbar:movetotrash"]'); | |
| // If no trash button, try clicking first individual checkbox instead | |
| if (!trashBtn) { | |
| console.log('Label click failed, trying individual checkboxes...'); | |
| const checkboxes = document.querySelectorAll('input[type="checkbox"]:not(#idSelectAll)'); | |
| checkboxes.forEach(cb => cb.click()); | |
| await new Promise(r => setTimeout(r, 1000)); | |
| trashBtn = document.querySelector('[data-testid="toolbar:movetotrash"]'); | |
| } | |
| if (!trashBtn) { console.log('No trash button. Inbox may be empty.'); break; } | |
| trashBtn.click(); | |
| // Handle confirmation dialog if any | |
| await new Promise(r => setTimeout(r, 1000)); | |
| const confirmBtn = document.querySelector('.modal-two-dialog button.button-solid-norm, [data-testid*="delete"] button'); | |
| if (confirmBtn) confirmBtn.click(); | |
| // Wait for deletion to process | |
| console.log('Deleting batch... waiting...'); | |
| await new Promise(r => setTimeout(r, 3000)); | |
| // Check if empty | |
| const remaining = document.querySelectorAll('input[type="checkbox"]:not(#idSelectAll)'); | |
| if (remaining.length === 0) { console.log('Inbox is empty!'); break; } | |
| console.log(`${remaining.length} emails remaining, continuing...`); | |
| } | |
| } | |
| deleteAllEmails(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment