tech stuff.

Migrate ProtonMail to GMail

leave a comment »

After trying ProtonMail for a year, I decided to migrate my email domain back to Google Workspace from ProtonMail. I like Proton, but in the end my users weren’t happy with the available features, and I was more interested in keeping my users happy.

Anyway, I needed to migrate a corpus of email from ProtonMail to GMail, and all the Internet had to offer was that I should use the Import-Export app to export my mail to mbox, use an extension to load the mbox into Thunderbird, and copy the mail using GMail IMAP.

GMail is great at handling millions of users simultaneously accessing their email, but high throughput from a single user isn’t its strong suit. When I attempted to copy more than 10 messages at a time via IMAP the operation would usually time out.

Here’s a solution for copying email from ProtonMail to GMail that worked better than IMAP for me (for Workspace users this requires imports from webmail hosts to be on):

  1. Export ProtonMail to a local mbox file using Proton’s Import-Export app.
  2. Copy the mbox file to a short-lived Cloud VM running a POP3 server.
  3. Use GMail’s import mail feature to have GMail fetch the messages from your server.

This worked really well. GMail connected every few minutes and pulled 200 messages at a time until all messages were transferred.

Creating a temporary mail server was easier than it sounds. The rough steps I took were:

  1. Create a GCE Instance running Debian 10. (I used a C3 instance because it was in free public preview, but GMail is conservative in its fetching so I would use an e2-micro next time.)
  2. Add GCE firewall rules to allow traffic to ports 80 (for Lets Encrypt) and 995 (for POP3 with SSL).
  3. Assign a DNS record for the host and follow the certbot instructions to obtain a Lets Encrypt certificate.
  4. Install dovecot-pop3d, updating the config for the path to the Lets Encrypt SSL certificate and setting the mail_location to ~/mbox.
  5. Add a mail user.

Almost surprisingly, that’s all I had to do. The whole process, including setting up the mail import, took around an hour.

Written by Lee Verberne

2023-04-15 at 18:28

Posted in Internet

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: