Mailserver

Contents

This article was initially tested on Debian 9 (stretch) and updated to Debian 10 (buster).

This article is shamelessly copied (and a little modified) from my friend edr, see https://wiki.rochefort.de/sysadmin/mailserver/.

Overview

A mail server setup consists of several software components that work together but must be installed and configured individually. This page is just an overview of the general process that contains references to other pages which document the indiviual components.

DNS

You will need (at least) the following DNS records.

A records:

smtp.yourdomain.com
imap.yourdomain.com
mail.yourdomain.com (for the webmailer)

A reverse DNS record for

smtp.yourdomain.com

An MX record for every domain that you want to accept mail for.

The subdomain names are arbitrary, you can pick whatever you like. You could also just use a single domain for everything, but it makes sense to split them up to be prepared for the event that you ever want to split services onto several servers. In that case you don’t have to reconfigure your mail clients.

SSL

See Let’s Encrypt.

SPAM Protection

To integrate spam protection you’ll be referencing SPAM assassin in the configuration of Postfix and Dovecot, so it makes sense to already install it upfront. See Spamassassin.

Mail Transfer Agent / SMTP Server

See Postfix.

Mail Delivery Agent / IMAP Server

See Dovecot.

Adding Users

To add a new user, do the following:

Optional: Mail signing (DKIM)

See Opendkim.

Optional: Webmailer

See SnappyMail Webmailer.