To running DBMailAdmin, you must match below requirements:

  • A working DBMail mail server, running on Debian (5.x or 6.x) or Ubuntu (8.04 LTS or later versions).
  • DBMail, version 2.x or 3.x. Stores mail accounts and messages in MySQL database.
  • Apache web server, version 2.2.0 or later.
    • mod_wsgi, Apache WSGI module, version 2.1 or later. WSGI module is used to host Python application which supports the Python WSGI interface.
  • Python, version 2.4 or later. Core programming language of DBMailAdmin. Warning: Python 3.x is not supported.
    •, version 0.32 or later. A python-powered web framework.
    • MySQLdb. A thread-compatible interface to the popular MySQL database server that provides the Python database API.

Note: After setting up by following this tutorial, you can access DBMailAdmin with URL: httpS://your_server/dbmailadmin/.

We will make DBMailAdmin run under Apache web server, as a seperated, low privilege user: dbmailadmin.

Execute below command to add this system account:

# useradd -m -s /sbin/nologin -d /home/dbmailadmin dbmailadmin

Install packages from official apt repositories as required dependence:

$ sudo apt-get install gcc python-setuptools python-dev \
                        libmysqlclient15-dev \
                        libapache2-mod-wsgi \

Install required python modules:

$ sudo easy_install Jinja2 DBUtils

Download DBMailAdmin:

  • If you purchased DBMailAdmin, you should already have it. If not, please mail to support@ to get a download link.
  • If you didn't purchase DBMailAdmin, download DBMailAdmin trial edition from download page.

Upload DBMailAdmin to your DBMail server, we assume you uploaded it to /root/DBMailAdmin-x.y.z.tar.bz2. Replace x.y.z by the actual version number here.

Execute below commands to extract DBMailAdmin to directory /usr/share/apache2/, set correct file permissions, and create symbol link.

# tar xjf DBMailAdmin-x.y.z.tar.bz2 -C /usr/share/apache2/
# cd /usr/share/apache2/
# chown -R dbmailadmin:dbmailadmin DBMailAdmin-x.y.z
# chmod -R 0555 DBMailAdmin-x.y.z
# ln -s DBMailAdmin-x.y.z dbmailadmin

Copy example config file, and set correct file permission.

# cd /usr/share/apache2/dbmailadmin/
# cp settings.ini.dbmail_mysql.sample settings.ini
# chown dbmailadmin:dbmailadmin settings.ini
# chmod 0400 settings.ini

Edit settings.ini and set necessary variables.

NOTE: Please open settings.ini for more detail, it's self-documented.

# File: settings.ini
# General settings ...

# Database "dbmailadmin". required by DBMailAdmin.

# Database "dbmail", stored all mail accounts and mail messages.

Create new Apache configure file /etc/httpd/conf.d/dbmailadmin.conf with below content.

# Note: Uncomment below two lines if you want to make DBMailAdmin accessible via HTTP.
#WSGIScriptAlias /dbmailadmin /usr/share/apache2/dbmailadmin/
#Alias /dbmailadmin/static /usr/share/apache2/dbmailadmin/static/

WSGISocketPrefix /var/run/wsgi
WSGIDaemonProcess dbmailadmin user=dbmailadmin threads=15
WSGIProcessGroup dbmailadmin

AddType text/html .py

<Directory /usr/share/apache2/dbmailadmin/>
    Order allow,deny
    Allow from all

Edit /etc/httpd/conf.d/ssl.conf, make DBMailAdmin accessible via HTTPS. Add below lines before </VirtualHost>:

WSGIScriptAlias /dbmailadmin /usr/share/apache2/dbmailadmin/
Alias /dbmailadmin/static /usr/share/apache2/dbmailadmin/static/

Restart apache to enable module mod_wsgi:

# /etc/init.d/httpd restart

We will create a new MySQL database "dbmailadmin" to store sessions, admin operation log for DBMailAdmin.

# mysql -uroot -p
mysql> CREATE DATABASE dbmailadmin DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> USE dbmailadmin;
mysql> SOURCE /usr/share/apache2/dbmailadmin/docs/samples/dbmailadmin.sql;

Execute below MySQL commands to create a new MySQL user, set password, and grant necessary privileges to this new user.

Note: Here we use 'plain_password' as password of MySQL user "dbmailadmin", please replace it by your own password.

# mysql -uroot -p
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON dbmailadmin.* TO dbmailadmin@localhost IDENTIFIED BY 'plain_password';

Create addition columns in DBMail database: dbmail.

Note: It will create several new tables to store domain administrator accounts, create two new columns on table "dbmail.dbmail_users" to store user name and mail domain name.

# mysql -uroot -p
mysql> USE dbmail;
mysql> SOURCE /usr/share/apache2/dbmailadmin/docs/samples/dbmail_addition.mysql;

Update MySQL records for existing mail accounts, fill new column "dbmail_users.domain" with domain name.

# mysql -uroot -p
mysql> USE dbmail;
mysql> UPDATE dbmail_users SET domain = SUBSTRING_INDEX(userid, '@', -1) WHERE domain = '' AND user_idnr > 3;

We will create a global domain admin here, you can login to DBMailAdmin with this account later.

  • Admin username:
  • Password: mypasswd

Get a encrypted password with OpenSSL:

# openssl passwd -1 'mypasswd'

Create a global domain admin with password generated above:

# mysql -uroot -p
mysql> USE dbmail;
mysql> INSERT INTO dbmail_admins (username, password) VALUES ('', '$1$Af1GkO6C$A8tu/zX1P6E4t4Mb0TpYk0');
mysql> INSERT INTO dbmail_domain_admins (username, domain) VALUES ('', 'ALL');

You can now access DBMailAdmin with admin account created above to manage your mail accounts.


Please post all issues, feedbacks, feature requests, suggestions in our online support forum, it's more responsible than you expected: (Forum: DBMailAdmin support).