There is a newer issue of thie ISPmail guide available if you are using Debian Jessie!
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:
apache2ctl restart
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:
apache2ctl restart
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 “john@example.org” 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 configuration
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 “tina@example.org” that has “cat pictures” in the subject line. Dovecot will then instantly send a copy of the message to “jill@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 john@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:
require [“copy”];
# rule:[Forward cat pictures to Jill]
if allof (header :contains “From” “tina@example.org”, header :contains “Subject” “cat pictures”)
{
redirect :copy “jill@example.com”;
}
So much for server-side rules. Have fun with them.
Great tutorial seems to be working well for me! How can I configure Postfix/Dovecot to save sent mail in a sent folder?
Usually that's a client issue. E.g. you can tell Thunderbird to keep a copy of all outgoing email in the "Sent" folder. However certain folder like "Sent", "Drafts" or "Trash" have a special meaning and Dovecot knows about it. You can configure those names in /etc/dovecot/conf.d/15-mailboxes.conf. But ultimately it depends on how the mail client uses those folders.
I thought RoundCube would store a copy of all outgoing mail in the “Sent” folder by default. I’m now finding that this is not the case.
Anyone using SOGo with this excellent tutorial?
If you have Roundcube on a different server than your postfix/dovecot server be sure specify the smtp server in your Roundcube main.inc.php file. Also, if you are forcing authentication you will need to prepend tls:// to your address. Like this:
$rcmail_config[‘smtp_server’] = ‘tls://12.34.56.78’;
Hi Chris and all on here.
For Chris, Thank you so much for your tutorials. I’ve used them quite a bit and it’s been a God-send. I setup my mail server entirely using your previous squeeze tutorial, and have almost got everything working/updated etc with wheezy. You are my hero.
So, my question for anyone that might have an idea; everything works except my sieve global setting. It worked before doing the upgrade (with the previous tutorial). However now, it appears to no longer work. I have checked my config files numerous times (to the best of my ability) and tried googling around for a couple days. I *think* sieve is indeed installed (at least it was on squeeze before I upgraded), but still even tried installing managesieve to see if that was the issue. Still no dice.
I have also tried putting the “sieve” plugin in the 20-imap.conf file but dovecot wasn’t happy about that.
So in my 15-lda file I have:
protocol lda {
mail_plugins = $mail_plugins sieve
}
In my 90-sieve I have:
plugin {
sieve = ~/.dovecot.sieve
sieve_dir = ~/sieve
sieve_global_dir = /var/vmail/globalsieverc
}
and the globalsieverc file (located at /var/vmail/globalsieverc) has:
require [“fileinto”];
# Move spam to spam folder
if header :contains “X-Spam-Flag” [“YES”] {
fileinto “Junk”;
stop;
}
I am NOT a linux administrator, I setup my linode about 6 months ago and when time permits I do work on it. So hopefully the suggestions won’t be overly technical and vague.
Thanks again everyone for the great tutorial!
Forgot to include, globalsieverc is vmail:vmail
The user sieve configs will “overwrite” the global sieve configs. The get them both used try sieve_before in the plugins settings.
That did the trick. I did read that rules per user override the global, but I never created any sieve user specific rules… maybe some install script or something did, **shrugS**. But I used sieve_before and it worked like a champ
Thanks for taking the time to help!
Cheers.
Hi, I am trying to solve my problem with sieve also. Appreciate if you can comment on my config either it was wrong or not. This is my 90-sieve.conf:
plugin {
#sieve = ~/.dovecot.sieve
#sieve_default = /var/lib/dovecot/sieve/default.sieve
#sieve_dir = ~/sieve
sieve_global_dir = /var/vmail2/globalsieverc
sieve_before = ~/.dovecot.sieve
sieve_before2 = ~/sieve
#sieve_before3 = (etc…)
}
Also, I already created a file /var/vmail/globalsieverc with:
require [“fileinto”];
# Move spam to spam folder
if header :contains “X-Spam-Flag” [“YES”] {
fileinto “spam”;
stop;
}
Actually I got this error in /var/log/roundcube/errors:
[31-May-2014 03:10:25 -0400]: PHP Error: Unable to connect to managesieve on noip.me:4190 in /usr/share/roundcube/plugins/managesieve/managesieve.php on line 286 (GET /roundcube/?_task=settings&_action=plugin.managesieve)
[31-May-2014 07:10:25 UTC] Not currently in AUTHORISATION state (1):
[31-May-2014 07:10:25 UTC] Not currently connected (1):
Looks like managesieve trying to connect to “noip.me:4190” but actually it should connect to “synthesisor.noip.me”. I dont have DNS so I pickup from no-ip site. I dont know why it just have “noip.me”. This error happened when I try to click on Filter tab on roundcube but it gives me error “Unable to connect to server”.
Thanks for any help.
I found my mistake regarding ‘sieve connectting to “noip.me” instead of “synthesisor.noip.me” ‘ in /etc/roundcube/main.inc.php:
should be ” $rcmail_config[‘managesieve_host’] = ‘localhost’; ”
NOT ” $rcmail_config[‘managesieve_host’] = ‘%localhost’; ” or
NOT $rcmail_config[‘managesieve_host’] = ‘%d’;
When I try to login it tells me “Connection to IMAP server failed” Everything has worked fine up to this part of the tutorial. Any thoughts?
Found a # in a bad spot in one of the numerous .conf files I went through. Also found a ” instead of a ‘. Damn typo’s.
telling us where you found the errant typos would be helpful to those of us following in your tracks, please?
Trying to log in with roundcube, it just says “login failed”.
Mail.log has, method=PLAIN, rip=::1, lip=::1, secured, session=
May 11 18:31:36 mailman dovecot: imap-login: Aborted login (auth failed, 1 attempts in 2 secs): user=
Any ideas where I’m going wrong here?
p.s. Also, curiously, I can connect with thunderbird when setting up a new account as long as I’m on my local network, but I get refused from Outlook (from within my network or outside) shortly after getting a message like “encrypted login is unavailable on this server, click next to attempt unencrypted” (which obviously fails). The curious part is that Thunderbird cannot get an encrypted connection from outside my network either.
as always, linux is a strongly typed OS, everything is case sensetive, including the email address i.e.: webmaster@xxx.com is not the same as Webmaster@xxx.com
“Elegant Roundcube Mobile Skins with Lustrous Mobile Friendly Looks” All Roundcube Skins are tested and are fully compatible with Roundcube 0.8.x, 0.9.x and newly released 1.0.1!!! we have included the Roundcube Skin for desktop, mobile and smartphone Live Demo and hurry to buy it with affordable cost all 16 colorful skins :- http://
example.com/Let me know if you would like to advertise on workaround.org. We can make a deal.
Hi Chris,
thanks a bunch for sharing this awesome guide with the rest of the world. How much trouble do you think it’d be to change the settings (everywhere) in order to use stronger password encryption, like SHA512 for example? I have searched a lot but could not find all the places this needs to be done (cause I can’t login). Apparently its more than a few… Thank you in advance and keep up the good work!
Can you help me in round cube change password module make work
Hi,
I managed to make the ‘password’ plugin of roundcube working with the following changes to its config.inc.php:
$rcmail_config[‘password_driver’] = ‘sql’;@localhost/mailserver’;
$rcmail_config[‘password_db_dsn’] = ‘mysql://mailuser:
$rcmail_config[‘password_query’] = ‘UPDATE virtual_users SET password=MD5(%p) WHERE email=%u’;
I strictly followed this tutorial, so if you changed the hash algorithm, this has to be reflected in the config above, of course.
Best regards
Andreas
I tried to use sieve filter as vacation reply but it only works when the recipment is getting mail to original address (with no alias redirection).
Which rc plugin should work nice as vacation reply ?
I tried to edit managesieve.sieve in user directory according to this:
http://thr3ads.net/dovecot/2009/07/1088935-Sieve-problem-No-vacation-message-when-mail-is-addressed-to-an-alias-of-the-mailbox
But it doesn’t work.
Has anyone found the solution ?
Has anyone in this galaxy been able to implement a calendar plugin on RoundCube? So far, after about a week of pounding on it, I’ve been unsuccessful. If you’ve done it with RoundCube 1.1.1, please let me know how. Thanks, Kent. (Going bald from pulling my hair out!)
I have just installed RoundCube 1.1.1 and after having this install finished to the end of this manual, I will eventually end up using myroundcube.com again like I do on my Windows webserver
This is a bunch of scripts on top of RoundCube which give me a Calendar, planner, webdav/caldav connector (if you install any card/caldav server)
It makes it a very nice full featured webmail client.
Additionally you can pay for certain plugins, I ended up spending about 15 euros for a dozen plugins 😀
Erik, which plugins and/or dependencies are needed for Calendar, planner and the webdav/caldav connector?
Thanks for your post btw,
Kent
I get the following error when i send from roundcube only. I can send from Thunderbird,etc. X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: “To”. Does anyone have a fix for this. I am running Ubuntu 14.04, Postfix, Apache2, Roundcube. This happened after i upgraded my roundcube.
Change for the latest version (1.2.1), there is a bug in version 1.2.
Hello, thank you for these beautiful tutorials.
I have installed a little server 2 years ago with this tutorial without problems.
Recently I have upgraded my roundcube to the 0.9.5 through backports.
All work well except for a double alias error message when I restart apache.
[….] Restarting web server: apache2[Sun Sep 18 10:40:23 2016] [warn] The Alias directive in /etc/apache2/conf.d/roundcube.conf at line 4 will probably never match because it overlaps an earlier Alias.
[Sun Sep 18 10:40:23 2016] [warn] The Alias directive in /etc/apache2/conf.d/roundcube.conf at line 5 will probably never match because it overlaps an earlier Alias.
… waiting [Sun Sep 18 10:40:24 2016] [warn] The Alias directive in /etc/apache2/conf.d/roundcube.conf at line 4 will probably never match because it overlaps an earlier Alias.
[Sun Sep 18 10:40:24 2016] [warn] The Alias directive in /etc/apache2/conf.d/roundcube.conf at line 5 will probably never match because it overlaps an earlier Alias.
. ok
Roundcube work without problems and can be reached to “roundcube” and “webmail” alias destinations.
The only problem is the error message when I restart apache.
I’m unable to find the double alias, please anyone know where find it?
Thank you in advance
Problem solved, I have two symbolik link that point to the same roundcube.conf.
I am also using Roundcube Webmail it is too good webmail platform. I am using Roundcubeskins with dis Webmail which I have taken from https://roundcubeskins.com/. Awesome Skins they are providing with additional features. I am very happy by using Roundcubeskins.