Hosting email server behind a provider reddit / selfhosted ---------------------------------------------------------------------- kdevkk · 2023-11-30 23:02 Hi folks, I am wondering if there are resources for setting up a private email server that acts as their primary but sends and receives emails through a provider such as proton. I've seen many posts on the cons of personal email hosting so to get around that, is it possible to use another provider in front of our own. My goal is really to keep a backup of all emails, but also to "easily" swap providers if needed (kind of like dependency injection), while maintaining operations on my end the same, i.e. use my own email server. I am inexperienced with email protocols and just hosting email servers in general. Would appreciate if someone can chime in and let me know if it is possible at all, and if there are good solutions. Thanks ---------------------------------------------------------------------- Exitcomestothis · 2023-12-01 05:42 Just so I understand, You’re wanting to self host a private email server that would act as a “primary” but would then send/receive email through another provider such as proton? This could be doable, depending on a few things. 1- does your ISP allocate you a static IP address? This will be required, as your upstream, public provider (ie, Proton) will need to be able to directly access it to send you your mail (this is done over SMTP). 2- If your ISP doesn’t allocate you a static, your next step would be to setup a VPS server on a platform like digital ocean and run your email server there. 3- If your ISP will allocate a static IP, you’d need to edit the MX records for your domain name (example.com for instance) to point to the servers for your provider (proton mail). This way, when INCOMING mail is received, it gets sent to protons mail servers, and then forwarded to your own mail server (more on that in a minute). You would also have to configure your hosted email server to properly send outgoing mail (via SMTP) and configure it with reverse DNS, SPF, DKIM, and DMARC, as to not have the bigger companies like Gmail and Microsoft mark your emails as spam. Additionally, you would also need to have an email server that’s capable of handling SMTP authentication for when you need to send an OUTGOING (SMTP) email, plus configure your server to only accept INCOMING connections from upstream provider proton. In addition, this server would also need to have authentication for OUTGOING mail (smtp) plus IMAP/POP for you to retrieve your email, etc. This is a bit of a condensed version of how things could go. I’ve been hosting email since 2007 and based on what you’re wanting to accomplish, I would go with the hosting option that your registrar provides, and use something like Thunderbird or Outlook to download your email, and make sure you backup your computer to preserve the emails. It will be much cleaner, cheaper, and more reliable. However, if you’re really wanting to host your own email, my advice is to use Zimbra (compile it or use one of the other builds) and host it yourself directly. I e self hosted my personal email for the last 15 years and haven’t ever had a problem (knock on wood). Feel free to DM if you have any questions. Good luck! ---------------------------------------------------------------------- tschloss · 2023-12-01 12:48 A simple approach would be to just run an IMAP server. For receiving you use a script using POP3 to download newly arrived emails (which is run every 5 minutes for example). If your server is offline, nothing gets lost. For the sending side you can either use your mail ISP’s SMTP server directly from the client or you install a local relay as a mitm to the ISP’s SMTP. ---------------------------------------------------------------------- kdevkk · 2023-12-02 02:04 Thank you for the detailed reply. I'm aiming to deploy it on a droplet. Ill give it a whirl and try it out, otherwise your suggestion for backing up via email downloads should work too. Do you have any suggestions for email servers specifically? Thanks ---------------------------------------------------------------------- bz386 · 2023-12-02 08:10 I use Fastmail as my email service. Then i self host an instance of Mailu. Every night all emails from Fastmail are synced to my Mailu instance using imapsync. This means I effectively have a copy of all my email and a complete email server ready to go. If anything happens with Fastmail, i just change the DNS records (MX, SPF, DKIM) over to my own email server and I’m back in business. ---------------------------------------------------------------------- kdevkk · 2023-12-27 08:41 Thanks. This is pretty close to the end goal I'm looking for. My initial thought on routing emails from private server would be too complicated. This gets me my backups and also ready to use in case of any issues.