Hosting your Own Email Part 2 —

Hosting your Own Email Part 2

by Joshua Branson — June 15, 2021

PROJECT My current plans for hosting email accounts

There are three basic vocab to know for setting up an email server

  • a mail transfer agent (MTA) receives and sends email (opensmtpd)
  • a mail delivery agent (MDA), which gets the email from the MTA, and stores it for a user. The easiest way is to use opensmtpd as the MDA. BUT dovecot is a better MDA, because dovecot can set up mail filtering and maybe better spam filtering.
  • Remote users can access the emails via an MUA (mail user agent), via an IMAP server. (dovecot)

My current simple strategy for hosting a few email accounts

I plan on offering paid email accounts on, or your own domain. So your next email could be "" or "". The following is an explanation of how it will all work together. It is intended for anyone else wanting to set up an email server for a few email accounts.

Opensmtpd is my MTA (mail transfer agent), so it sends and receives email via smtp. Also, opensmtpd uses rspamd (or bogofilter) to limit spam.

Dovecot will serve my emails. For now I will set up emails in the maildir format, because this is easy to do. Eventually, I will store email in the dbox format.

  • will be where dovecot serves emails
  • will be where opensmtp sends and receives email

The simple directory structure I will use to host a few email accounts

I will have a few email accounts at <users> postmaster AT will point to my main user AT

My email will be hosted at: /home/<user>/Maildir

I will tell dovecot to serve emails from the above directory via a config variable:

(dovecot-service #:config
                     (dovecot-configuration (mail-location "maildir:~/%n/Maildir")))

By default both opensmtpd and dovecot use regular login username authentication. So my username and password that I login via email is the same password that I use to login via ssh. So my email config for should look like this for gnus:

(nnimap ""
        (nnimap-stream ssl)
        (nnimap-address "")
        (nnimap-user "joshua"))

Some difficulties

  • I login via "joshua" and <password>. I would prefer to login via joshua AT That way I can distinguish joshua AT and joshua AT

  • The above explanation strategy delivers all emails to /home/joshua/Maildir, which essentially limits my total email accounts to one.

  • The above has no spam filtering or email filtering.