Mail relay server behind firewall

Hello everybody.

First of all, I would like to apologize if this question is stupid but I feel like I am missing something…

For more than 10 years, our small company uses the mail service of cPanel on a VPS. The clients (Thunderbird on Ubuntu) retrieve the emails via POP and automatically delete them from the server after 25 days (so emails are kept on the client side only and the server never gets full). We have some shared email addresses (such as “sales@ourdomain.com”) so we often ask each other “did you reply to this email?”. I am thinking about switching to IMAP on MIAB to solve this problem.

I understand I would have to convert our mailboxes to IMAP and upload them to the new server but I don’t like the idea of storing 10 years of emails (~500GB) on a machine connected to the internet. So I was wondering if I could use a kind of “mail relay” between the clients and MIAB.

The idea is:

  • The “mail relay” would be in our LAN (behind our firewall) and would act as a client of MIAB to retrieve (via POP) and send (via SMTP) all emails

  • The Thunderbird clients (in the same LAN) would connect to the “mail relay” to retrieve (via IMAP) and send (via SMTP) all emails

I found this project http://www.imapproxy.org/ but it looks quite old.

So to summarize, I would like to have emails stored on a machine within our LAN + offer the possibility to share an email address.

What would you advise?

Thanks in advance for any help!

Hello,
I thought this setup would be more popular but I didn’t get any answer. Can someone kindly explain me how I could set up a “relay” (within our LAN) to act between our Thunderbird clients (in the same LAN) and our MIAB server (on a VPS outside our LAN) ?
Thanks for any help!

Auto BCC back to the account … then everyone can see that a reply was sent - or not.

How much money do you have to throw at this? It can be done, but it will cost $$$$.

Thanks for your answer. I would prefer a proper IMAP solution as everyone would see the “replied” arrow in Thunderbird

I already have the hardware (Dell R720 with plenty of space / ram / CPU left). About software, I was thinking about free/libre open source

For ‘shared’ inboxes … sure this works.

At the end, I found an easy solution that I tested successfully: getmail + dovecot.

Basically, a virtual machine in my LAN uses getmail to poll the emails from the public server (MIAB) via POP and deposit them in maildir format in directories managed by dovecot (to share them to the clients via IMAP). The clients, connect to this “relay” to poll emails (via IMAP) and to MIAB to send email (via SMTP). The “sent items” are automatically deposited in the IMAP sent directory every time the clients synchronize.

Here are some interesting links:
https://joel.porquet.org/wiki/hacking/getmail_dovecot/
https://work-work.work/blog/2018/12/15/getmail-systemd-imap-idle.html
https://help.ubuntu.com/community/Dovecot
https://help.ubuntu.com/lts/serverguide/dovecot-server.html

The advantages are:

  • all emails are on a same machine so it’s easy to backup (especially with ZFS)
  • the machine is safe behind a closed firewall (except VPN) and clients access from LAN only
  • I can include emails from mail servers I don’t control (gmail, yahoo, …)
  • I can share mailboxes via IMAP and use custom tags to affect the employee who needs to answer an email (http://www.grimeton.com/custom-tags-with-thunderbird-stored-on-imap-server/)