Fix mail on Ubuntu – VestaCP

Fix mail on Ubuntu – VestaCP

When installing VestaCP on Ubuntu, mail errors may occur. For example:

  • Unsuccessful connection to IMAP server
  • Invalid HELO name
  • AUTHENTICATE LOGIN: in /usr/share/roundcube/program/lib/Roundcube/rcube_imap.php ..
  • Initialization failed: namespace configuration error: inbox=yes namespace missing

The first step is to repair the RoundCube.

Go to /etc/apache2/conf.d edit paths to /usr/share/roundcube/:

Alias /webmail /usr/share/roundcube/

# Access to tinymce files
<Directory "/usr/share/roundcube/">
      Options Indexes MultiViews FollowSymLinks
      AllowOverride None
      Order allow,deny
      allow from all
</Directory>

<Directory /usr/share/roundcube/>
  Options +FollowSymLinks
  # This is needed to parse /var/lib/roundcube/.htaccess. See its
  # content before setting AllowOverride to None.
  AllowOverride All
  order allow,deny
  allow from all
</Directory>

Next, update Roundcube:

cd /usr/share/roundcube/
wget https://github.com/roundcube/roundcubemail/releases/download/1.4.13/roundcubemail-1.4.13-complete.tar.gz
tar -xvf roundcubemail-1.4.13-complete.tar.gz
mv roundcubemail-1.4.13/* ./ ; mv roundcubemail-1.4.13/.htaccess ./
rm -rf roundcubemail-1.4.13*

We create a database:

mysql
CREATE DATABASE roundcubedb;
CREATE USER 'roundcubedb'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON roundcubedb.* TO 'roundcubedb'@'localhost';

Follow the link:  https://123.123.123.123/webmail/installer  and install Roundcube.

Where – 123.123.123.123 – is the IP of your server.

After installation, reconfigure Exim:

dpkg-reconfigure exim4-config

We select the first item and then we indicate everything given for our domain.

Then we fix the dovecot config:

nano  /etc/dovecot/conf.d/15-mailboxes.conf

At the beginning of the namespace inbox { } section, add the line:

inbox = yes

Then we edit the Roundcube config:

nano /usr/share/roundcube/config/config.inc.php

We register in $config[‘default_host’] – the IP address of the server.

Next, we edit the file:

nano /usr/share/roundcube/config/defaults.inc.php

We prescribe:

$config['default_host'] = '123.123.123.123';
$config['imap_auth_type'] = 'LOGIN';
$config['smtp_server'] = '123.123.123.123';
$config['smtp_auth_type'] = LOGIN;
$config['smtp_helo_host'] = 'localhost';

Where, 123.123.123.123 is ‘localhost’ or the IP address of your server.

Ready. The mail is working.