TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Deploy a Gmail-like email server in 30 (ish) minutes

192 pointsby acallaghanover 3 years ago

28 comments

avianover 3 years ago
It's not the initial setup. It's the maintenance over the years that really makes you question the universe, life and the decision to host your own mail. When you can't send that important mail because $big_provider is blocking you. When someone decides to run a persistent brute force attack from a botnet, eating up 100% of your CPU and you have no meaningful ways to block it. When you need to explain to people why they can't send you that 100 MB video attachment which they sent to other people just fine but only your address is bouncing and why don't you fix your email already. When you need to research, understand and implement standard X pushed by $big_provider because otherwise things will stop working and you have a ton of better things to do. When you get a random alert that email volume is too large and you panic because someone hacked your server and is probably sending spam but realize it was just triggered by a huge kernel patch series sent by someone on a mailing list. When a zero-day CVE for your mail software just hit the top of the HN and the fix is not in your distro yet and you scramble to find a workaround. When a bunch of weird log lines appear in your mail logs and you don't understand where they are coming from and they seem benign but can't lose the feeling that someone is trying something malicious. When you constantly fear that you'll lose that good IP and domain reputation and one day wake up with half of the internet blocking you.
评论 #29692620 未加载
评论 #29693007 未加载
评论 #29692871 未加载
评论 #29693834 未加载
评论 #29695520 未加载
评论 #29696549 未加载
评论 #29693288 未加载
评论 #29698228 未加载
评论 #29692878 未加载
评论 #29695810 未加载
评论 #29700605 未加载
评论 #29695717 未加载
评论 #29692758 未加载
15characterslonover 3 years ago
&gt; It was easier than I thought to create a mail server that works as well as Gmail’s<p>No it isn&#x27;t and no you didn&#x27;t.<p>The article doesn&#x27;t even cover basic stuff like email rules and spam filtering (incl. tuning and spam learning). It doesn&#x27;t &quot;look after itself&quot; like the author wanted (article doesn&#x27;t mention any update strategy). The author acknowledges that email servers are &quot;open to attack&quot; but this setup doesn&#x27;t seem to include any security improvements over traditional setups. In fact, maintaining this looks harder due to the amount of custom scripts and lack of good documentation.<p>And of course it doesn&#x27;t cover any of the things that actually make Gmail special like labels, having a consistent set of apps for web and mobile, push notifications (esp. on iOS), really good spam filtering, really good search (incl. OCR for attachments), high availability, image proxying, smart suggestions, datacenter security, Google doing code and infrastructure audits all the time, using reproducible builds, ...<p>It&#x27;s great that the author is experimenting and learning, but if I had any private data hosted by the author, I would be worried now.
评论 #29694412 未加载
评论 #29696905 未加载
评论 #29694117 未加载
评论 #29700712 未加载
评论 #29693056 未加载
tuldiaover 3 years ago
The nicest email stack is: postfix, dovecot, rspamd and rainloop.<p>EDIT: go check it out :-) <a href="https:&#x2F;&#x2F;www.rainloop.net&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.rainloop.net&#x2F;</a><p>EDIT 2: I don&#x27;t understand why other comments are so agressive against the author for sharing how he runs his own mail server, I&#x27;m not sure if it comes from one&#x27;s frustration, failures, unreasonable expectations about email, but I noticed that everything related to servers or email receives this hate (here on HN, eh?). Come on, let&#x27;s start a new year where we appreciate someone sharing their experience in running a mail server :-)<p>Happy Holidays!
评论 #29693154 未加载
评论 #29694363 未加载
评论 #29692876 未加载
sirabenover 3 years ago
I recently got into running my own mail server on my NixOS instance using[0]. The server has a total of 1.5 GB RAM and 10 GB of disk space, but it was sufficient to get 10&#x2F;10 on mail tester[1]. Here&#x27;s my 12 line mailserver config[2]. It was quite liberating once everything was set up, because then you know you are in full control of your communications.<p>It was more annoying to set up DNS than the mailserver itself, is there a good way to automate that as well?<p>[0] <a href="https:&#x2F;&#x2F;gitlab.com&#x2F;simple-nixos-mailserver&#x2F;nixos-mailserver" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;simple-nixos-mailserver&#x2F;nixos-mailserver</a><p>[1] <a href="https:&#x2F;&#x2F;www.mail-tester.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.mail-tester.com&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;siraben&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;server&#x2F;mailserver.nix" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;siraben&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;server&#x2F;mails...</a>
评论 #29693348 未加载
评论 #29693469 未加载
geoahover 3 years ago
&gt; The blog article is the setup to make Docker Mailserver act like a Gmail server.<p>I&#x27;m not sure what a Gmail server is. I was expecting this to include a web ui, admin ui, and the things that actually make Gmail hard to move away from. The docker-mailserver container doesn&#x27;t seem to include something like that or am I just not seeing it?<p>The killer feature for Gmail has always been the spam protection and the fact that the emails I sent actually get delivered.
评论 #29695178 未加载
johnklosover 3 years ago
This is nice, but even though I&#x27;ve administered email servers for a quarter of a century, I haven&#x27;t got the foggiest clue what makes an email server &quot;Gmail-like&quot;. What does &quot;Gmail server&quot; mean?<p>I would think, if anything, that what Gmail has that typical email servers do not is somewhat decent webmail, but that can&#x27;t be it because webmail isn&#x27;t even mentioned.<p>Or is this another one of those instances where people use &quot;Linux&quot; to refer to all things Unix? I genuinely would like to know.
评论 #29694812 未加载
评论 #29696453 未加载
lazywebover 3 years ago
In my experience [1] running a small private mail server is very much doable, and a good learning experience.<p>[1] <a href="https:&#x2F;&#x2F;jschumacher.info&#x2F;2021&#x2F;05&#x2F;running-a-private-mail-server-for-six-years-easy-peasy&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jschumacher.info&#x2F;2021&#x2F;05&#x2F;running-a-private-mail-serv...</a>
focomover 3 years ago
I think those projects:<p>- <a href="https:&#x2F;&#x2F;mailinabox.email&#x2F;" rel="nofollow">https:&#x2F;&#x2F;mailinabox.email&#x2F;</a><p>- <a href="https:&#x2F;&#x2F;github.com&#x2F;modoboa&#x2F;modoboa" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;modoboa&#x2F;modoboa</a><p>are better replacement. They are battery included with a webUI
评论 #29693392 未加载
ireflectover 3 years ago
So many negative comments, sheesh.<p>Many of us run our own small email servers quite successfully, even in 2021. Every time there&#x27;s a post about it on HN, all these commenters come forward to say it&#x27;s a fools errand, that it&#x27;s nearly impossible, nobody should try it, anybody who says it&#x27;s a good idea is a lying idiot, etc.<p>Sure, it&#x27;s not for everyone and there are pitfalls that require effort and sometimes creative solutions to overcome. We should celebrate these projects like we do with other similarly challenging projects that get posted.
jeroenhdover 3 years ago
You can&#x27;t replicate Gmail, but with Mailcow I&#x27;ve gotta say the whole process is pretty seamless. You can throw it onto a 5 euro VPS at Contabo, run docker-compose up and be done. Just regularly run the update and backup scripts to make sure you&#x27;re up to date but that&#x27;s it, really.<p>Exchange ActiveSync, multi domain + multi aliases with catchalls, (temporary) aliases, mail delivery rules, TLS requirements, you name it, all configurable in the web UI. There&#x27;s even a built in DNS checking tool to verify that all the necessary records are set up right.
评论 #29696984 未加载
评论 #29694138 未加载
评论 #29694452 未加载
twobitshifterover 3 years ago
If you just want your own address, iCloud+ now supports custom domains. You might already be subscribed to it and not know it. This also includes private relay and email hiding. It might be the easiest way to move your email out of gmail.<p><a href="https:&#x2F;&#x2F;support.apple.com&#x2F;guide&#x2F;icloud&#x2F;add-a-custom-domain-mma473945269&#x2F;icloud" rel="nofollow">https:&#x2F;&#x2F;support.apple.com&#x2F;guide&#x2F;icloud&#x2F;add-a-custom-domain-m...</a>
评论 #29693932 未加载
评论 #29693484 未加载
bsd44over 3 years ago
I had to manage email infrastructure for years as part of my job and I really don&#x27;t see how running your own email server can be a good idea for anyone. Setting it up superficially might be a quick and easy task but maintaining it stable takes hell of a lot of effort. I seriously cringe every time I see this type of guide and articles, it just makes me think that people who write them have zero experience running a mail server and have no idea what it takes to set up one that is secure and stable.<p>For majority of people best middle ground is to buy a cheap domain and a cheap cPanel&#x2F;web hosting and just use that to host emails. You&#x27;ll be done in 5min, it will cost you a cup of coffee and you won&#x27;t have the headache maintaining anything other than passwords.
评论 #29694294 未加载
评论 #29700764 未加载
eooover 3 years ago
AFAIK Digital Ocean blocks outbound connections to port 25. Has the author actually tried this setup?<p>Source: <a href="https:&#x2F;&#x2F;docs.digitalocean.com&#x2F;support&#x2F;why-is-smtp-blocked&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.digitalocean.com&#x2F;support&#x2F;why-is-smtp-blocked&#x2F;</a>
评论 #29695779 未加载
评论 #29694473 未加载
评论 #29698016 未加载
throwaway984393over 3 years ago
You know, it&#x27;s possible to build a house by yourself in about a day or two with no knowledge of carpentry. But I wouldn&#x27;t want to live in it :)
istillwritecodeover 3 years ago
incoming email is easy. Outgoing email is a whole different ball game. I tried setting up an SMTP server on digital ocean and found it to be impossible due to the fact that all Digital Ocean IP ranges are on various blacklists. I moved the server to AWS and was able to eventually get a running SMTP server, but it requires additional steps to gain the trust of AWS and outlook.com and other providers. It SHOULD be possible to set up an email server if you never never never never never send marketing email. If you DO send marketing email, then your stuff should be sent straight to the garbage bin and you should be on a blacklist. That&#x27;s the whole point of spam.
pigbearpigover 3 years ago
I&#x27;ll be interested in the one month update post.
remramover 3 years ago
What&#x27;s a good way to monitor a self-hosted mail server? I can easily set up uptimerobot.com or similar and get alerted if my website fails, whether it&#x27;s a DNS, IP, firewall, nginx, TLS^, application, or database issue. Is there a way to check my mail server and get alerted if it is not accepting emails for some reason?<p>^: uptimerobot.com specifically doesn&#x27;t warn you if your site works but is using an expired certificate, be careful there
评论 #29695196 未加载
systemsincodeover 3 years ago
Good article - seems comparing with Gmail upset some peeps but well done for having a go and trying to not just using off the shelf saas for every little things. Progress should have made it easier to host stuff ourselves not harder right?
评论 #29696339 未加载
maltrisover 3 years ago
For docker and mail, also check out &quot;mailcow dockerized&quot;. Lovely stack of software, been using it for 5 years with no problems.
imwillofficialover 3 years ago
This absolutely nothing like gmail. The great parts of gmail can’t be replicated at home anymore, unfortunately.
评论 #29693815 未加载
mysterydipover 3 years ago
Let&#x27;s say I&#x27;m tired of self-hosting my email (for all the reasons previously mentioned by others). What&#x27;s a good option of privacy-conscious provider I can move my domains to?
评论 #29696000 未加载
Tepixover 3 years ago
Now you have your own mail server. Great! But if you don&#x27;t know how it works or if you don&#x27;t have something that will help you maintain it, sooner or later it will break.
评论 #29696511 未加载
boplicityover 3 years ago
You can deploy an email server almost instantly by getting a cheap vps with cPanel on it -- with everything you needed already configured, including spam filtering, security, etc.
salzigover 3 years ago
Uhm, what about MailCow[0]? found it quite a while ago. Didn’t test it so far.<p>[0]: <a href="https:&#x2F;&#x2F;mailcow.email&#x2F;" rel="nofollow">https:&#x2F;&#x2F;mailcow.email&#x2F;</a>
oliwarnerover 3 years ago
It opens with some fair points why somebody might not, but the main reason —perhaps on par with the constant security headaches— isn&#x27;t there. You will <i>never</i> block spam as effectively as Google, Microsoft, FastMail, etc.<p>They see [for lack of a better word] infinite times more spam and ham than you&#x27;ll ever be able to train your little Spam Assassin database, and millions of users to sort through it.<p>Email without spam control is not a pleasant experience.
评论 #29696493 未加载
评论 #29700773 未加载
ohiovrover 3 years ago
Mail servers are all pretty much blacklisted by IP unless you work some kind of deal with someone somewhere.
评论 #29695573 未加载
danlugo92over 3 years ago
Zoho has a 1 dollar a year plan for using with your own domain.
评论 #29697286 未加载
tuananhover 3 years ago
define gmail-like :)