Setting Up Email A-Z
Assign the Domain to a System User
This guide assumes you have already run the installer for Site Wrangler’s email system. If you have not, follow this guide. As usual, replace example.com with your domain and exampleuser with a real username.
First, if you do not already have a system user to store the email under, create a new user:
sw user create exampleuser
Now that we have a system user to store the email files under, we can assign the domain to the system user. A system user can be associated with multiple domains for email. Contrarily, a domain can only be associated with one domain. To assign the domain to a system user run this command:
sw email setdomain example.com exampleuser
It is worth pointing out that the above command can be used to assign the domain to a different system user later on, but files will not be copied over automatically. (File moves may be added at a later date)
Create a DKIM Key Pair
When the DKIM key pair is created, by default, the private key is used to sign mail and the public key is inserted into the DNS zone file of the domain. If the domain does not have a DNS zone file on the server, the DKIM keys will still be created and used to sign outgoing email, but the public key will need to be deployed to DNS manually. For this reason. If you use a 3rd party nameserver for DNS, you may still want to have a DNS zone file on the server for the domain that you can use to copy the DKIM record from.
The raw keys are stored in a path that may vary depending on your system, but will resemble:
/etc/exim4/dkim/
If you need to create a DNS zone file, run this command:
sw dns add example.com
To create and install a new DKIM key pair, run this command:
sw email dkim example.com
Add an SSL Certificate
Because Site Wrangler is set up to only allow IMAP and POP connections over SSL, at least one domain name on the server needs to be covered by a certificate. Ideally, all domains that run email on the server should be covered by a certificate so that mail clients can connect using the email’s domain.
If you have not already enabled SSL certificates for the domain, you can run the following command to enable SSL. Once enabled, the server will continue to renew certificates through Let’s Encrypt automatically.
sw cert add example.com
Create an Email User
Now that the domain is all set up, we can start adding email users. Run this command to create a new email user:
sw email add exampleuser@example.com
Now that the user exists, we have the option of also enabling SpamAssassin. We can either enable SpamAssassin for the entire domain, or for just the user. Use the appropriate command to enable SpamAssassin:
sw email saenable example.com sw email saenable exampleuser@example.com