Qmail

qmail is Mail Transfer Agent (MTA).]]

Pre-installation
As only one MTA can be installed at the same time on a system, it might be required to deselect an installed MTA. The package manager will report a block when another MTA is still installed. For example, a previously selected can be marked as removable with this command:

Installation
has several USE flags that may be desired for certain bigger setups. As this article aims at installing and configuring a basic netqmail setup, adding qmail plugin support with qmail-spp and ucspi-tcp support is necessary.

Configuration
The default 16 MiB of memory for qmail is a little sparse. Update the memory to 32 MiB to avoid memory related errors.

Setting up non-root account for mail
The design of qmail has been completely around the focus of security. To this end, e-mail is never sent to the user root. Select a user on the machine to receive mail that would normally be destined for root. The remainder of this guide will that user as myusername.

Or to send this email elsewhere, simply put the full address in:

Fully Qualified Domain Name (FQDN)
Though not entirely related, for an MTA to function properly, it is imperative that its hostname is set up correctly. Under Gentoo and  are the files responsible for this. In this example, the mail server is named foo on the domain example.com.

Verifying that the FQDN is setup properly for the domain.

Creating Properly Signed Certificates
Move to the qmail control directory:

Upgrade the Cert Info to create a 2048bit key:

Update the Cert Info with information pertinent to this host. CN is the fully qualified domain name ie. foo.domain.com:

create the pem files and key:

Get the contents of the request pem file:

Send req.pem to a CA(ie godaddy/Starfield, Versign, etc.) to obtain signed_req.pem:

Alternatively, obtain a key from Let's_Encrypt

Start qmail and add it to the default run level
Run the init scripts and setup supervisor links for qmail:

start and add netqmail to the default run level:

vpopmail
vpopmail will handle virtual domains, adding, deleting mail domains, accounts, storing passwords etc. vpopmail uses mysql in this setup. Please configure MariaDB or MySQL to follow these instructions.

First we need to tell qmail to use vpopmail when checking smtp passwords:

Let's install and setup :

Create the vpopmail database:

Edit and update the mysql password for the vpopmail user:

dovecot
Finally add to talk to the email clients:

Add vpopmail UID info to the default dovecot config:

Edit dovecot SSL configs to pass the SSL certificate to email clients when the login to get mail securely:

}}

Start dovecot and add to the default runlevel: