Mua hàng tại Link Shopee hoặc Hotline 0345-148-136.

Small self-hosted mail server on FreeBSD

I used to self-host my email server before with and it works.

I moved my server from Linux to FreeBSD last week then I can’t bring my old email since doesn’t support FreeBSD.

People usually host their mail with a combine of Postfix and Dovecot but I need a simple solution for my small business.

I found some softwares may fit my need:

  • Mox – modern, secure, all-in-one email server
  • Maddy Mail Server – ✉️ Composable all-in-one mail server

Both Mox and Maddy are dead simple. Mox has web ui but Maddy maybe easier to config and I’ll go with Maddy.

I made an jail then install Maddy on it.

I follow Maddy docs, build it from source since FreeBSD doens’t has Maddy package.

Install packages and build

# pkg install git-lite vim go scdoc
# git clone
# cd maddy
# git checkout v0.7.1
# ./
# ./ install
# touch /usr/local/etc/rc.d/maddy
# chmod +x /usr/local/etc/rc.d/maddy

Write the rc.d script

# vim /usr/local/etc/rc.d/maddy
root@mail:~ # cat /usr/local/etc/rc.d/maddy

# PROVIDE: maddy
# KEYWORD: shutdown

. /etc/rc.subr


: ${maddy_config:=/etc/maddy/maddy.conf}
: ${maddy_logfile:=/var/log/maddy.log}

command_args="-c -f -o ${maddy_logfile} -P ${pidfile} /usr/local/bin/${name} --config ${maddy_config} run"

load_rc_config $name
run_rc_command "$1"

I mount certs from host to jail by nullfs then edit maddy confile file.

Multiple domains config can be found here. I’m only use one hostname and TLS certificate ~ for all of my domains.

I’m using relay so I remove “target.remote outbound_delivery” block, add “target.smtp relay”

Change “target.queue remote_queue”, from “&outbound_delivery” to “&relay”.

This can be found here.

Add maddy service then start it

# sysrc maddy_enable=YES
# service maddy start


Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *