Not sure if there’s a pre-existing solution to this, so I figured I’d just ask to save myself some trouble. I’m running out of space in my Gmail account and switching email providers isn’t something I’m interested in. I don’t want to pay for Google Drive and I already self-host a ton of other things, so I’m wondering if there is a way to basically offload the storage for the account.

It’s been like 2 decades since I set up an email server, but it’s possible to have an email client download all the messages from Gmail and remove them from the server. I would like to set up a service on my servers to do that and then act as mail server for my clients. Gmail would still be the outgoing relay and the always-on remote mailbox, but emails would eventually be stored locally where I have plenty of space.

All my clients are VPN’d together with Tailscale, so the lack of external access is not an issue. I’m sure I could slap something roughshod together with Linux packages but if there’s a good application for doing this out there already, I’d rather use it and save some time.

Any suggestions? I run all my other stuff in Kubernetes, so if there’s one with a Helm chart already I’d prefer it. Not opposed to rolling my own image if needed though.

13 points
*

Bit of a different solution:

If Paperless-NGX is one of the things you self-host; it has options to import emails based on your specified criteria, then you could have it delete each piece of mail it imports. You can also just have it move mail to folders on the mail server, or just tag/flag mail instead of deleting it. (for you to then manually delete at your leisure)

I use this to automatically import receipts, bills, work documents, and any other regular mail instead of dealing with it manually every week/month.

permalink
report
reply
4 points

I’ve never noticed that in the docs! That’s pretty cool. I’ll have to try set it up sometime.

permalink
report
parent
reply
1 point

My mind is blown! (And my paperlessngx server is about to get really busy!!! :)

permalink
report
parent
reply
7 points

Not sure if it fits you, but personally I have set up a self hosted dovecot instance where i have moved old gmail emails to, using thunderbird as the client.

permalink
report
reply
6 points

I wrote this ansible role to setup dovecot IMAP server. Once a year I move all mail from the previous year from various mailboxes to my dovecot server (using thunderbird).

permalink
report
reply
4 points

Do they need to be the same mailbox?

Could you have a ‘live’ and ‘archive’ split?

If you could, then I’d use something like imapsync to make a complete mirror copy, and then delete all email older than whatever the age is that makes them outside of your usual working set, and bam, done.

The problem you’re going to have is there’s a LOT of tools that can sync imap->imap, but they’re more migration or backup tools and won’t let you delete the email from gmail afterwards while maintaining a usable archive, which I think is a requirement to solve your issue.

permalink
report
reply
1 point

Yeah, they are ideally the same mailbox. I’d like a similar experience to Gmail, but with all the emails rehomed to my server.

permalink
report
parent
reply
4 points

I’ve setup exactly what you’ve described. Some of the stories of people suddenly losing access to their Google accounts scared me enough that I wanted a copy of all my emails locally in case the same thing happened to me.

I setup an IMAP email server using Dovecot which I can access over my Tailnet from various client machines. I use Getmail on the server to periodically poll Gmail every few minutes for any new messages via POP access. Anything new is downloaded and dumped in the user’s inbox.

It’s a pretty solid setup - I’ve been using it for years.

permalink
report
reply

Selfhosted

!selfhosted@lemmy.world

Create post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

Community stats

  • 3.4K

    Monthly active users

  • 1.6K

    Posts

  • 14K

    Comments