Tested 3/28/2019

1. Stop services

qmailctl stop && systemctl stop dovecot

2. Install and enable higher priority QMT MD repo, and  Install QMT MD packages.

CentOS 7/QMT only
wget -O /etc/yum.repos.d/qmt-md.repo  https://raw.githubusercontent.com/qmtoaster/mirrorlist/master/qmt-md-centos7.repo
yum-config-manager --enable qmt-md-current
wget -P /etc/yum.repos.d https://raw.githubusercontent.com/qmtoaster/scripts/master/dovecot.repo
yum makecache
yum clean all
yum update dovecot qmail ezmlm ezmlm-cgi vpopmail qmailadmin vqadmin
yum install dovecot-mysql

CentOS 8/QMT
wget -O /etc/yum.repos.d/qmt-md.repo  https://raw.githubusercontent.com/qmtoaster/mirrorlist/master/qmt-md-centos8.repo
yum-config-manager --enable qmt-md-testing
wget -P /etc/yum.repos.d https://raw.githubusercontent.com/qmtoaster/scripts/master/dovecot.repo
yum makecache
yum clean all
yum update dovecot qmail ezmlm ezmlm-cgi vpopmail qmailadmin vqadmin
yum install dovecot-mysql

Make sure packages to be installed are designated '.md'.

3. Create new vpopmail database (script)

#!/bin/sh

# This script converts the vpopmail db from a many table format--the table names
# of the form domain_tld (domain.tld)--to one vpopmail table that is similar to 
# the former with the addition of the tld, thus 'many domains'.

# In addition to this vpopmail db conversion appropriate replacement packages
# must be installed to interact with the converted db, CentOS 7 pkgs here, and
# CentOS 8 pkgs here. The conversion was necessary to utilize Dovecot's dsync utility, specifically,
# it's requirement for the command `doveadm user '*'` which fails with the 
# vpopmail driver (replaced by sql driver) in the standard QMT installation.

DB=vpopmail
DBPASSWD=xxxxxx

mysql -p$DBPASSWD -D $DB -e "CREATE TABLE vpopmail \
(pw_name char(32) NOT NULL, \
pw_domain char(96) NOT NULL, \
pw_passwd char(40) DEFAULT NULL, \
pw_uid int(11) DEFAULT NULL, \
pw_gid int(11) DEFAULT NULL, \
pw_gecos char(48) DEFAULT NULL, \
pw_dir char(160) DEFAULT NULL, \
pw_shell char(20) DEFAULT NULL,\
pw_clear_passwd char(16) DEFAULT NULL, \
PRIMARY KEY (pw_name,pw_domain)) ENGINE=InnoDB DEFAULT CHARSET=latin1"
[ "$?" != "0" ] && echo "Error creating vpopmail table" && exit 1
for i in `echo "show tables" | mysql -p$DBPASSWD $DB|grep -v Tables_in_`;
do
        if ! [ $i = dir_control ] && ! [ $i = lastauth ] && ! [ $i = vlog ] && ! [ $i = valias ] && ! [ $i = vpopmail ]; then
                # MySQL does not allow table names with a dot (.) so vpopmail replaces the dot (.) with an underscore (_) for 
                # domain table names, example: table whitehorsetc.com becomes whitehorsetc_com. Vpopmail utilities will not allow 
                # one to create a domain name with an underscore even though RFC allows it. So, we can safely replace all domain 
                # table name underscores (_) with periods or dots (.) (below, 'domain_name') in our conversion for entry into the
                # new vpopmail many domains table.
                domain_name=`echo $i | sed -e 's/\(.*\)_/\1./' -e 's/_/-/g'`
                echo $domain_name;
                mysql -p$DBPASSWD -D $DB -B --skip-column-names -e \
                "INSERT INTO vpopmail SELECT pw_name, '$domain_name', pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell, pw_clear_passwd \
                FROM $i"
        fi
done

4. Start services

qmailctl start && systemctl start dovecot

All updated packages should be using the new db and dovecot the sql driver (below).

The file here should now exist in the dovecot directory '/etc/dovecot/dovecot-sql.conf.ext' 
and the new sql driver in file '/etc/dovecot/toaster.conf' (below).

New sql user/password db driver (green)

passdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}

userdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}

Replaces

Old vpopmail user/password db driver (red)

passdb {
  args = cache_key=%u%r webmail=127.0.0.1
  driver = vpopmail
}
userdb {
  args = cache_key=%u quota_template=quota_rule=*:backend=%q
  driver = vpopmail
}