Skip to content

Instantly share code, notes, and snippets.

@lyndsysimon
Created July 29, 2020 16:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lyndsysimon/e6a4a1becaddf09fe02c503793b545d6 to your computer and use it in GitHub Desktop.
Save lyndsysimon/e6a4a1becaddf09fe02c503793b545d6 to your computer and use it in GitHub Desktop.
Protonmail inbox cleaner
/* Lyndsy's Protonmail mass archiver
*
* This is a simple script that marks all emails in a folder as
* read and archives them.
*
* I wrote it to work against the Protonmail Beta interface:
* https://beta.protonmail.com
*
* Usage:
* - Navigate to your inbox (or another folder, presumably)
* - Open your browser's developer tools' Javascript console
* - Paste in this script
* - Go get a cup of coffee; or maybe just go to bed if you have
* as many unread emails as I did :)
*/
let markAsRead = function() { $('a.pm-group-button')[0].click() };
let selectAll = function() { $("#selectAll").click() };
let archive = function() { $('button[data-action=archive]').click() };
function markAsReadAndArchive() {
selectAll();
setTimeout(markAsRead, 1000);
setTimeout(archive, 3000);
}
setInterval(markAsReadAndArchive, 10000);
@t2na
Copy link

t2na commented Jun 10, 2021

I'm unfortunately getting error messages trying to run this with chromium. Thanks for making it though.

@t2na
Copy link

t2na commented Jun 10, 2021

Uncaught ReferenceError: $ is not defined
at selectAll (:2:30)
at markAsReadAndArchive (:6:3)
at r (helpers.ts:87)
selectAll @ VM79:2
markAsReadAndArchive @ VM79:6
r @ helpers.ts:87
setInterval (async)
(anonymous) @ trycatch.ts:119
(anonymous) @ VM79:11
instrument.ts:158 POST https://mail.protonmail.com/api/reports/sentry/api/9/store/?sentry_key=64982c67a00b4e68833169e2c4f26819&sentry_version=7 net::ERR_BLOCKED_BY_CLIENT

@apazzy
Copy link

apazzy commented Jan 23, 2022

EDIT: Removed code in this comment, forked and updated the scripts here: https://gist.github.com/apazzy/33af2c32e066ae8e6c0a9c224ebdf72b

@lyndsysimon
Copy link
Author

@apazzy Thank you!

Sorry for the very late reply; I no longer regularly use GitHub. My employer uses Gitlab for their projects, and I've migrated my active stuff to Sourcehut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment