In this tutorial, we'll walk through setting up WebMail Pro alongside iRedMail – it's a free mailserver bundle that uses Postfix and Dovecot mail server components, Nginx webserver and MySQL/MariaDB database backend.
We're going to assume that a fresh installation of iRedMail is deployed per this documentation page. We've used Ubuntu 20.04 in our tests, but the process shouldn't differ much should a different Linux distro be used.
Database setup
First of all, we'll need to create a database that will be used by WebMail Pro. Root user password is assigned when setting up iRedMail, you can check iRedMail.tips file where credentials are stored after iRedMail is setup.
Run the following commands to create user and database, with all the required privileges assigned:
CREATE USER 'afterlogic'@'localhost' IDENTIFIED BY 'your_password';
CREATE DATABASE IF NOT EXISTS afterlogic;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, REFERENCES, CREATE TEMPORARY TABLES ON afterlogic.* TO 'afterlogic'@'localhost' IDENTIFIED BY 'your_password';
FLUSH privileges;
Installing WebMail Pro
Use the following commands to download and extract the product package:
cd /var/www/html
mkdir webmail
cd ./webmail
wget https://afterlogic.com/download/webmail-pro-php.zip
unzip ./webmail-pro-php.zip
chown -R www-data:www-data /var/www/html/webmail
Before proceeding with configuring the installation, it's important to secure data directory (which holds all the configuration files) from access over the web. To achieve that, edit /etc/nginx/sites-available/00-default-ssl.conf
configuration file and add the following block inside the server
section:
location ^~ /webmail/data {
deny all;
return 403;
}
Then restart Nginx service with:
service nginx restart
Configuring the installation
Now you need to open WebMail Pro admin interface in web browser, append /webmail/adminpanel/
to main installation URL of iRedMail. Supply superadmin login and an empty password.
Once in there, specify the license key, set admin access password, check "Database Settings" screen, supply afterlogic for database name and user name, and the password you used when creating the database.
Aside from using "Create/Update Tables" tool, it's important to use "Update configuration" as well – but we'll get back to this one in the final step of this tutorial.
One last item to configure here is "Mail Servers" screen. You'll need to add a mail server – use any display name, leave list of domains empty, and specify 127.0.0.1 for server host (port 143 for IMAP, 25 for SMTP).
Now you should be able to log out of the admin interface and log into any of the email accounts hosted by your iRedMail installation.
Enabling Password change feature
Unlike accessing mailboxes via IMAP and SMTP, password change feature doesn't have a standard protocol and needs to be implemented separately for a specific mailserver environment. We've created a number of password change modules, one is available for iRedMail as well. Use the following commands to download and install it:
cd /root
wget https://github.com/afterlogic/aurora-module-mail-change-password-iredmail-plugin/archive/master.zip
unzip ./master.zip
mkdir /var/www/html/webmail/modules/MailChangePasswordIredmailPlugin
cp /root/aurora-module-mail-change-password-iredmail-plugin-master/* /var/www/html/webmail/modules/MailChangePasswordIredmailPlugin
Once the module is in place, log into admin interface and click "Update configuration" button. That tool ensures that configuration files required by all the modules are created under data/settings/modules
directory.
Locate data/settings/modules/MailChangePasswordIredmailPlugin.config.json
configuration file, initially it looks like this:
{
"Disabled": [
false,
"bool",
null,
"Setting to true disables the module"
],
"SupportedServers": [
[
"*"
],
"array",
null,
"If IMAP Server value of the mailserver is in this list, password change is enabled for it. * enables it for all the servers."
],
"DbUser": [
"vmailadmin",
"string",
null,
"Defines username for accessing iRedMail database"
],
"DbPass": [
"",
"string",
null,
"Defines password for accessing iRedMail database"
]
}
You need to supply actual database credentials, either for root or vmailadmin account. It can be found in iRedMail.tips
file created upon the installation, next to the installer script.
Also, edit data/settings/modules/ChangePasswordWebclient.config.json
file and set Disabled to false there, to ensure that password change button is displayed in the user interface.
This concludes the tutorial. If you run into any issues, feel free to open a ticket in our HelpDesk.