Apparently an increasing number of users does not want to up an email client like Thunderbird. Instead they believe that email is supposed to be managed using their web browsers. To each their own. So let’s set up RoundCube as a webmail software to make them happy. RoundCube is a web application written in PHP that provides a user-friendly web interface that speaks IMAP with any mail server.
Enabling RoundCube through the Apache web server
You should already have the ’roundcube’ package installed. The /usr/share/doc/roundcube-core/README.Debian file gives you additional information on how to make RoundCube available from your Apache web server.
If you are not using Apache virtual hosts (just one web site)
Basically if you just use the web server on your mail server to provide a webmail interface you can uncomment the “Alias” directives in the /etc/apache2/conf.d/roundcube file and restart Apache:
If you are using Apache virtual hosts (co-exist with other web sites on your server)
If you have are running multiple virtual hosts on your server then do not enable the two “Alias” directives in /etc/apache2/conf.d/roundcube but instead put them into the <VirtualHost> section of the desired virtual host. For example you could set up a web server at https://webmail.example.org/ and add a
Redirect permanent / https://YOUR-MAILSERVER/roundcube
statement to your HTTP instance (listening on TCP port 80). Then restart Apache:
Testing the login
Point your web browser to the /roundcube/ path of your mail server (e.g. https://YOUR-MAILSERVER/roundcube/). If all worked as expected you will be greated by RoundCube’s login dialog:
You should already be able to login using the username “email@example.com” and the password “summersun”. As a server enter “localhost” – we will get rid of that field in a minute. Click on “Login” and you should get to your inbox:
Fine-tuning the configuration
Let’s edit the main configuration file at /etc/roundcube/main.inc.php and incorporate these changes:
$rcmail_config[‘default_host’] = ‘localhost’;
(Disables the “Server” field and always uses the local server using IMAP.)
$rcmail_config[‘force_https’] = true;
(Makes sure that you do not accidentally let users send their login data over an insecure HTTP connection.)
I recommend you go through the various settings to customize RoundCube with your logo and think about security and convenience features. All features are well-documented.
Sieve is a functionality that allows to use server-side rules to deal with emails on the server. Dovecot supports such rules and you have already set it up to listen on a network port for requests using the “managesieve” protocol that allows you to add, remove or edit such rules. RoundCube fortunately speaks “managesieve” – you just have to tell it how to talk to Dovecot. Start by copying the default configuration file to the required position:
cp /usr/share/roundcube/plugins/managesieve/config.inc.php.dist /etc/roundcube/plugins/managesieve/config.inc.php
Then edit the /etc/roundcube/plugins/managesieve/config.inc.php file and set the correct TCP port that Dovecot expects managesieve connections on:
$rcmail_config[‘managesieve_port’] = 4190;
Also enable the “managesieve” RoundCube plugin by editing this line to the /etc/roundcube/main.inc.php file:
$rcmail_config[‘plugins’] = array(‘managesieve’);
Now when you click on “Settings” in the top right-hand corner of the RoundCube web interface you will see four tabs where the last is called “Filters”. Click on it:
These are the rules that Dovecot obeys for the current email account. Well – there are none yet. But you can add any filter rules in the “Filters” pane by clicking on the “+” icon. That lets you add rules.
The “Filter name” is just a human-readable name that helps you remember what you intended when you created this rule (e.g. “move Tina’s emails to the ‘tina’ folder”). The “For incoming mail” section lets you define criteria that need to match if you want this rule to run. And the “…execute the following actions” depicts the actions that Dovecot will do with such emails.
Or lets consider another example:
This filter acts on all incoming email from the sender email address “firstname.lastname@example.org” that has “cat pictures” in the subject line. Dovecot will then instantly send a copy of the message to “email@example.com”. You can use these filters to sort emails to folders, delete certain bogus emails, respond to them or to active an out-of-office notification.
The filter rules are save in the mail directory of the respective user. For firstname.lastname@example.org such rules get saved to: “/var/vmail/example.org/john/sieve/managesieve.sieve”. The above rule would look like this in machine-readable format:
# rule:[Forward cat pictures to Jill]
if allof (header :contains “From” “email@example.com”, header :contains “Subject” “cat pictures”)
redirect :copy “firstname.lastname@example.org”;
So much for server-side rules. Have fun with them.