Mail-in-a-Box email

I used Mail-in-a-Box email during setup to use with Discourse. Mail-in-a-Box is an automatic self hosted email system where you run the script on a new Ubuntu 14.04 box with a dedicated domain name for email and it sets up everything for you and all you need to do is create email accounts and update the software regularly. I recommend it for managing your own email and it works for setting up an account for use with websites. I made server@r3df0x.net and I use that to send email from websites. You aren’t dependent on any third party service if you host your own email.

I ran into a problem where I couldn’t get the first activation email so I activated my account manually. I successfully sent a test email from the admin panel so it looks like email will work now. I rebuild the app several times since then and I changed the nameservers used by the email box to what it looks like Mail-in-a-Box expects, so this might have helped mail delivery.

Cheap hosting for Mail-in-a-Box

Since one of the obvious goals of using Mail-in-a-Box is reducing expenses, it would make sense to host it on a very cheap hosting.

I initially wanted to use a 2.5$/mo VPS at Vultr. However, they refused opening SMTP ports, so I switched to a $5/mo DigitalOcean. Anyway, you’ll definitely want a dedicated VPS for your mail service.

Because that tiny VPS only has 512 MB RAM, you should setup a 2GB swap file before installing Mail-in-a-Box.

Dedicated domain name (cheap, too)

It’s advisable by Mail-in-a-Box to have a separate domain.

By comparing domain renewal and registration prices for various .TLDs at namecheap.com, I discovered one of the cheapest one is .com.de:

.work $6.88
.space $7.88
.one $8.88
.me.uk $5.69
.ws $8.88
.space $7.88
.bid $5.58 (5+ years)
.link $8.88
.com.de $4.88 (! cheapest)

Take into account that while registration price can be discounted, the regular renewal price may be high. So don’t forget to expand the “Renew” price section and search in there.

Please note with .com.de you won’t be able to setup DNSSEC, which improves email security, because this particular TLD (domain extension) does not support DNSSEC at the registry level (citing namecheap).

Step by step

Register domain name.

Create your new VPS, set its hostname to the domain name you just bought.

Check VPS’s IP against blacklists in MXToolbox. If blacklisted, destroy VPS and create a new one, and repeat until you find an IP that’s not blacklisted.

Mail-in-a-box can manage nameservers for you, but if you want to setup this way, first check whether your TLD requires two different IP addresses for nameservers, and whether you’re ready to purchase one more IP address. For instance, DO doesn’t allow more than 1 IP per droplet, so with a .com.de you won’t be able to get Mail-in-a-box to manage your DNS for you.

So, if you went this way, in your domain control panel, set two nameservers for the domain you just bought:

ns1.your-mail-dedicated-domain.com
ns2.your-mail-dedicated-domain.com

— Make both link to your VPS IP address(es). (instructions for namecheap.com)

Finally, setup Mail-in-a-box and follow instructions as by the link. The automatic installation process may take 10+ minutes, especially on small VPS.

Multiple domains

Mail in a box may service emails for multiple domains.

So I’m slowly migrating all my small projects from using 3rd party mail hosting (sometimes not free) to my own Mail-in-a-box (free in terms of direct expenses, but not free in terms of my time spent on configuration and maintenance). Ask me in a private message if you want me to setup a dedicated mail-in-a-box for you in your VPS.

Note that you will still suffer from poor deliverability until systems learn to trust the IP you are sending from, which takes time and email delivery over a period of many months. And some systems will categorically never trust mail sent from shared hosting IP ranges.

Just wanted to update that after ~1.5 years, I’m still happy with Mail-in-a-Box, and deliverability is no longer a problem since the IP gained some good reputation thanks to the Discourse way to rate recipients.

I know very little about the “reputation” thing, but I suppose the longer you send no-spam emails from your IP, the better is your reputation.

Will keep using my dedicated $5/mo Mail-in-a-Box server - and using it for 3 forums now.

Thanks for this. I’ve been putting off running a mail server for several years now, but several things would be easier if I did. Glad it’s working out for you.

다른 분들도 이 문제를 겪고 있다면 (저도 그랬습니다), 무료 Mailjet 계정을 설정하고 MiaB 고객 설정에서 도메인의 SPF와 DKIM을 인증하세요. 여전히 Miab 계정에서 notifications@ 또는 no-reply@ 이메일을 사용할 수 있으며, Discourse와 같은 앱의 다른 호스팅된 트랜잭션 이메일에는 Mailjet에서 제공하는 자격 증명이 작동하여 설정 시 발생할 수 있는 문제를 줄여줍니다.

P.S. 설정에 정말 인내심을 갖고 기다리면 Miab 설정이 작동하는 경우도 있었던 것 같습니다. 하지만 자체 호스팅된 이메일 자격 증명을 사용하고 최종 인증 이메일을 기다리다가 설치 완료가 끝없이 지연되고 있는 분들에게 도움을 드리고 싶었습니다. 해당 인증에 Mailjet 사용자로 전환하면 몇 분 만에 이메일이 도착합니다.

저희는 discourse 설치 환경에서 mailcow를 사용하고 있으며, 이메일은 사용자의 99%에게 정상적으로 전달됩니다. 나머지 1%는 hotmail 사용자들로, 이들에게는 다른 이메일 주소를 사용하도록 권장하고 있습니다.

새로운 Discourse 인스턴스를 설치해야 했기 때문에, mail-in-a-box용 최신 작동 중인 Discourse SMTP 구성을 공유합니다:

  DISCOURSE_SMTP_ADDRESS: my.smtp.domain.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: mailer@mydomain.com
  DISCOURSE_SMTP_PASSWORD: mypassword
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (선택 사항, 기본값 true)
  DISCOURSE_SMTP_DOMAIN: mydomain.com
  DISCOURSE_SMTP_AUTHENTICATION: "plain"
  DISCOURSE_NOTIFICATION_EMAIL: mailer@mydomain.com
  DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none

최근에 등록한 도메인에서 메일을 보내는 경우, SpamAssassin이 점수를 인위적으로 낮출 수 있다는 점을 유의하세요:

이것은 상당히 큰 페널티입니다!