Is there a selfhosted webmail client or solution that downloads and stores emails locally? reddit / selfhosted ---------------------------------------------------------------------- Redux28 · 2023-10-19 15:45 Hello all, i am not sure if plain webmail is the right category for what i'm looking for. I already have a mail server running in a hosting VPS that has been running for years and handles sending and receiving emails without issues or being flagged as spam, what I'm trying to accomplish is: * Handling the storage of very old and large mailboxes (imap 20gb+) to my local server since my VPS is runing out of space. * Continue using the VPS email server to receive/send emails. Since i'm not at all interested in selfhosting the email server and dealing with all those issues. * Multiuser since several family members have the same issue. * Selfhosted so we can check/send email from any device/mobile. Something that works similar (but obviously not selfhosted) is adding a POP3 account to Gmail/Outlook/etc and then adding the "send mail as" SMTP credentials of the server. I would like to replicate the same but selfhosted if possible. Is there anything that works like this? ---------------------------------------------------------------------- ElevenNotes · 2023-10-19 15:51 Could run https://poste.io locally? ---------------------------------------------------------------------- borouhin · 2023-10-19 16:55 IMO, you're overcomplicating things a lot. You already have a working mail server, which is not easy to setup and maintain. Adding another mail server and redistributing mail storage / routing mail between the two will drastically decrease stability and may affect deliverability of your mail as well. Why not just add storage to the existing VPS? If your hosting provider doesn't provide such option, you can mount third-party S3-compatiple storage (rclone mount works great, a few hundred Gb on Backblaze cost virtually nothing) and store your mail there. ---------------------------------------------------------------------- selfguest · 2023-10-19 18:13 Like [doveadm-sync](https://doc.dovecot.org/3.0/man/doveadm-sync.1/), you mean? ---------------------------------------------------------------------- talent_deprived · 2023-10-19 18:13 You could do what I did and move the mail server to a local machine or VM then use Wireguard on the VPS which tells iptables to route incoming mail traffic ports to the now local mail server. Then you can use as much space as you want. ---------------------------------------------------------------------- Proximus88 · 2023-10-19 18:24 I use [imap-backup](https://github.com/joeyates/imap-backup) to backup my MailCow email boxes. It can backup archive emails through imap and restore them to a new mailbox. Run it daily through cron. ---------------------------------------------------------------------- olluz · 2023-10-19 19:34 Are you looking for a way to archive older mails like Mailstore ? ---------------------------------------------------------------------- Redux28 · 2023-10-19 22:37 If i am reading it correctly, this would keep two imap accounts in sync , sadly that would not solve the storage problem on the VPS for me :( ---------------------------------------------------------------------- Redux28 · 2023-10-19 22:44 Thank you, this tool looks great to move and backup imap mailboxes and I saved the link for the future. I'm trying to think if i could get accomplish what Im trying to do by ruining a local imap server and pointing a webmail client to that and then just running this every few minutes. Seems a bit hacky tho. ---------------------------------------------------------------------- Redux28 · 2023-10-19 22:54 You may be correct and it looks like this might be the cleanest solution to my problem. I could even try to mount my local storage using wireguard and NFS. But I imagine network issues or downtime while receiving mails could mean big trouble, but that's only an issue if I selfhost the storage and not pay for third party storage. In my mind i was so sure that something already existed that was both a webmail client and also supported local storage of email lol, for some reason still it just makes sense to me. ---------------------------------------------------------------------- Redux28 · 2023-10-19 22:59 Thank you, i'm reading the documentation to see if i can figure out how to make it work mostly as a client that sends emails thru the VPS email server. ---------------------------------------------------------------------- gentoorax · 2023-10-19 23:32 How do you deal with outages on the local mail server VM do you queue mail? What about sending mail as I know outbound smtp can be difficult to avoid getting spammed ---------------------------------------------------------------------- borouhin · 2023-10-20 00:31 You call it "webmail client", but if it stores email and serves it to other clients - it's already server anyway :) And you mentioned you need to "check/send email from any device/mobile". You're probably not going to use webmail from mobile (it must be a disappointing experience)... so you need IMAP on this "client-server" too. At least you can keep SMTP part unchanged on your VPS and send via it directly... But if you have something like ActiveSync (SoGo etc.) - things get more interesting. Even without ActiveSync, CalDAV/CardDAV also can be an additional problem if you need to archive old calendars as well as mail... etc. Considering all these nuances that may arise in course of implementing your idea, I've suggested an easier way. ---------------------------------------------------------------------- NikStalwart · 2023-10-20 00:52 Look into [mail retrieval agents](https://wiki.archlinux.org/title/Lis t_of_applications#Mail_retrieval_agents) like fdm. ---------------------------------------------------------------------- talent_deprived · 2023-10-20 01:42 1) [https://serverfault.com/questions/117906/what-happens-when-a-mail- server-goes-down](https://serverfault.com/questions/117906/what- happens-when-a-mail-server-goes-down) "The SMTP protocol is very resilient in design. Most modern MTAs will attempt to resend a message every 4 hours for up to 5 days though this is configurable by the particular systems admin there is usually very little need to change from this." 2) Get a clean IP, there are many online sites that offer to check an IP: [http://www.mxtoolbox.com/](http://www.mxtoolbox.com/) Then make sure your server is configured well so it doesn't get a bad rep: [https://www.linuxbabe.com/mail-server/setup-basic-postfix-mail- sever-ubuntu](https://www.linuxbabe.com/mail-server/setup-basic- postfix-mail-sever-ubuntu) by setting up SPF, DKIM and DMARC. ---------------------------------------------------------------------- GrumpyCat79 · 2023-10-20 07:53 I use fetchmail to grab mail from an email provider and deliver it to my dovecot instance hosted at home. My mail provider is just used to store mail temporarly (up to a minute unless my server is down) and send email (I use their SMTP server). That way, my data is stored at home but I don't have usual 'selfhosted mail server' issues. I can be down for days and my email will be received by my provider and I don't need to do/setup/maintain anything to ensure my mail will be deliverable! With a custom domain and nothing that stay on their server, I can switch provider within a few minutes by updating the nameserver to point my domain to another server ---------------------------------------------------------------------- linxbro5000 · 2023-10-20 15:21 is it possible that you share a link or some ideas how to implement this solution? I am looking for something like this for some time. ---------------------------------------------------------------------- GrumpyCat79 · 2023-10-20 17:19 To be honnest, I never really saw anything exactly like my setup, but you just need to setup dovecot and fetchmail, then point your email client to your dovecot IMAP server and your SMTP server of choice Here's a few guide that can be usefull, but I didn't use them so I don't know how good they are https://www.digitalocean.com/community/tutorials/how-to-set-up-a- postfix-e-mail-server-with-dovecot (You don't **need** postfix, but it can be useful if you want internal email delivery (all my notifications and services use my postfix server so everything stay local and never reach my provider) https://ubuntu.com/server/docs/mail-dovecot https://www.linode.com/docs/guides/using-fetchmail-to-retrieve-email/ https://www.howtoforge.com/debian_fetchmail/ Feel free to ask me if you have specific questions! ---------------------------------------------------------------------- linxbro5000 · 2023-10-20 18:04 can your setup download all the emails from a catchall adress and "sort" the emails to the proper email-adress/receiver on your own server? ---------------------------------------------------------------------- GrumpyCat79 · 2023-10-20 23:24 According to Fetchmail's manual it looks possible, but they say it isn't a good idea due to some edge cases like mailing lists and blind copy which will end up not being sorted correctly. See their doc here: https://www.fetchmail.info/fetchmail-man.html#bad-ways-to-abuse- multidrop-mailboxes It may or may not work, I'm not sure, but using a catchall with multiple users isn't really ideal/usual, unless they all receive a copy of all mail maybe?