Scheduled Email Sending with ProtonMail

  • Posted: February 10, 2021
  • Updated: February 10, 2021
setTimeout(function() {$("button.mobileFull:nth-child(4)").click()}, <msec>);

This will, in the v3.16.57 version (and maybe others) of the ProtonMail web client, automatically send the email being written in the “New Message” dialog in <msec> milliseconds. Now on to…

The Story

My own email story is quite a convoluted one, but one I think many tech, security, and privacy-oriented folks go through. I started off with one Gmail account, progressed to two, then made a ProtonMail account, and finally moved on to my own domain with Migadu for the mail hosting.1 While I am in the process of deleting Google-everything, I don’t have plans on doing that for ProtonMail so I continue to use it; I like their services and occasionally use ProtonVPN.

During one late night (read: 5:00 AM), I began an email sync between an old and new provider for one of my clients. The rather large amount of emails meant that this transfer could take a while, so I wanted to schedule an email to be sent in the morning when I estimated the transfer to complete. Now here’s the thing about ProtonMail:

Combined with my own home-server situation of switching from Debian to Alpine but not yet setting up the Hydroxide bridge, I couldn’t use any of the other standard Unix tools like sendmail combined with after. So, I resorted to my little bit of Javascript knowledge combined with some grade 2 arithmetic and figured I could automate the clicking of the “Send” button on the “New Message” dialog to occur in the morning. All I used was the setTimeout function, alongside a bit of jQuery which was conveniently included in the web client.2

So there you have it, at least until ProtonMail adds this feature natively. Hopefully this illustrates the importance of thinking outside the mailbox and shows that the simplest solutions can be quite great for non-critical work.

  1. I could do it myself, but I’m happy to pay a little bit every year to not have to deal with maintenance, etc. Also, I save by hosting other emails with the same plan. ↩︎

  2. This is totally possible without jQuery, as with technically anything jQuery. ↩︎