Skip to content

Instantly share code, notes, and snippets.

@sleemanj
Created December 1, 2023 06:21
Show Gist options
  • Save sleemanj/a72581498cb1aa92ea477a1ded8c91d2 to your computer and use it in GitHub Desktop.
Save sleemanj/a72581498cb1aa92ea477a1ded8c91d2 to your computer and use it in GitHub Desktop.
Undelete (Restore From Trash) bulk Zoho Mail messages (more than 300 messages to restore).
/* Javascript snippet for when you accidentially move thousands of emails to the Zoho Mail Trash and want to restore them
* Zoho only lets you restore up to 300 at a time, you can't select all.
*
* This hacky javascript works around it. Open Zoho Mail and go into the Trash, open the console with CTRL-SHIFT-J
* paste this in, and then it will just sit there hitting the select-all checkbox and then the restore button for gogoCycleCount times
* to restore 50 emails at a time. Set the cycle count to however many emails you are restoring divided by 50.
*
* DO NOT TOUCH THE ZOHO MAIL WINDOW WHILE IT IS WORKING, no checks are made that it is in the Trash folder.
*
*/
var gogoCycleCount = 10;
function gogoCycle()
{
function gogoSelect()
{
document.querySelector('button#checkBox').click();
}
function gogoUndelete()
{
document.querySelector('button#restore').click();
}
gogoSelect();
window.setTimeout(gogoUndelete,1000);
if(gogoCycleCount-->0)
window.setTimeout(gogoCycle,12000);
console.log(gogoCycleCount);
}
gogoCycle();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment