Your personal GMail-like mail system: the web interface

So you got the system which is as good as GMail, but you also want to have the Web interface. This comes handy when you’re in the middle of changing e-mail clients, or you’re traveling without your laptop and want to check your e-mail from the public Internet cafe. So you want to have the Webmail access to your mail – which, obviously, should not disrupt your regular e-mail flow.

After trying several free solutions I decided to use the RoundCube. It was simple enough to install and configure, and it has the best Web interface I’ve seen so far around free webmail solutions.

This post assumes you have installed and configured the Apache with mod_php5 on your Linux web server, or you know how to do so.

Installing RoundCube

The installation itself is very simple and consist of pretty straightforward steps:

  • Download the latest stable RoundCube version from the project SourceForge page
  • Create a roundcube directory in your web server root and unpack the archive content there. It creates the roundcubemail-0.x directory.
  • Move all the files from there. Make sure you moved .htaccess file as well. Try rmdir roundcubemail-0.* – if you get “Directory not empty” error you forgot it. You should now have the whole installation in your /roundcube directory.
  • Password-protect the directory if you’re security-aware, just in case there are security issues with RoundCube which you won’t find in time about. This could be done by adding the following content to the .htaccess file:
AuthType Basic
AuthName "RoundCube install"
AuthUserFile user.passwd
AuthBasicProvider file
AuthUserFile /path/to/auth/file/outside/the/web/directory
Require valid-user

and create the auth file specified in the AuthUserFile by running htpasswd2. I also suggest making it readable by the web server only:

sudo htpasswd2 -c /path/to/auth/file/outside/the/web/directory roundcube
  • The line below adds the roundcube user with the password you specified. Remember it.
  • Make the roundcube temp and logs directories writable by the web server
<strong><span style="font-size: medium;">Creating the SQLite database</span></strong>

I suggest to use the SQLite database for roundcube. You’re not going to use it often and heavily so there is no need to run the heavy database daemon.

Type the following:

> mkdir sqlite
> sqlite -init SQL/sqlite.initial.sql sqlite/sqlite.db
> sudo chown -R wwwrun sqlite

You need this because to use SQLite the process requires write permission on the directory the database is stored (to create journal files).

The version of RoundCube I installed had an error in the SQL script. If you get the similar error message:

CREATE UNIQUE INDEX ix_searches_user_type_name (user_id, type, name);
SQL error: near "(": syntax error
SQLite version 2.8.17
Enter ".help" for instructions

Just press “Ctrl+D” to exit sqlite prompt, and edit the SQL/sqlite.initial.sql file. Find the following line:

CREATE UNIQUE INDEX ix_searches_user_type_name (user_id, type, name);

and edit it so it looks like that:

CREATE UNIQUE INDEX ix_searches_user_type_name <span style="background-color: #ffd700;">ON searches</span> (user_id, type, name);

then delete the sqlite/sqlite.db file and try again.

Configuring RoundCube

  • Open the browser and point it to http://<your site>/roundcube/installer/
  • Login as the user roundcube with the password you specified above when running the htpasswd2 line.
  • Press the “Start installation” button below.
  • The next screen verifies that you have everything which is needed to run RoundCube. If it lists missing modules, install them. For the “available databases” make sure it says “OK” near SQLite; ignore any error with other databases there. Press Next.
  • In the next screen scroll to the Database setup. Select SQLite in the listbox. Type the full path (including the file name) of the sqlite.db you just created in the previous step there. Leave other fields intact.
  • In the IMAP settings add your hostname/IP as ssl://
  • Do the same in SMTP settings assuming you did set up a local SMTP server. For SMTP you have to specify the port, use 587. Leave the smtp_user/smtp_pass empty and check the “Use the current IMAP username and password for SMTP authentication” checkbox below.
  • The next screen will show you two configuration files and asks you to copy them to the server. Download them in your browser and scp them to the web server into the roundcube/config/ directory.
  • Scroll down the screen and find the Continue button somewhere in the middle (not on the bottom). Press it.
  • On this screen it verifies the configuration and database. Should be OK everywhere. You may also test your IMAP/SMTP there. Don’t worry if IMAP port is shown as 143, if you set it as ssl:// it will connect properly.
  • Once everything is fine, go back to your console and delete the installer folder from your roundcube installation.

Using RoundCube

Open the and login with your IMAP credentials. You should be able to login successfully. If RoundCube still says “login failed” and you’re sure your credentials are correct, most likely you forgot to change permissions on the sqlite directory in the database file. Both should be owned by the user your web server is run under.

Once you log in you should see the message list. Messages are opened using the double click. Enjoy!

This entry was posted in Email.

Leave a Reply

Your email address will not be published. Required fields are marked *

Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /home/ulduzs/public_html/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048