Install and configure RoundCube Webmail on IIS

Categories:

RoundCube Webmail is an web based IMAP client that uses AJAX to provide a drag and drop interface that operates very much like a regular desktop application. RoundCube is Open Source and PHP based using a MySQL or Postgres database for data storage with a presentation layer that is fully skinnable using XHTML and CSS 2. Feature wise RoundCube includes things such as multilingual support, MIME support, personal address book, folder management, message searching and spell checking just to name a few. I've been using RoundCube for several years now to access my personal email from all corners of the globe, and I absolutely swear by it which is why I've decided to write this install guide for IIS.

RoundCube Webmail Requirements

There are a few things you'll need first in order to be able to use RoundCube in your IIS environment;

  • Email server with IMAP service (required) and SMTP service (recommended). I recommend using hMailServer for this which is an Open Source Email server developed for Windows, and can be installed by following my guide on setting up your own email server with hMailServer
  • MySQL or PostgreSQL database engine, or the SQLite extension for PHP. I recommend using MySQL as it is used by many other web applications you may use down the line, and can be installed by following my guide on how to install and configure MySQL 5 on Windows.
  • Finally, you must have PHP installed on IIS which can be done by following my guide on installing PHP 5 on IIS in 5 simple steps. In addition you may wish to enable these PECL extensions which can be done by following my guide on enabling PHP PECL extensions for Windows;
    • OpenSSL (recommended)
    • FileInfo (optional)
    • Multibyte/mbstring (optional)
    • Mcrypt (optional)

    While you're at it you best ensure these php.ini directives are set correctly ;

    • error_reporting E_ALL & ~E_NOTICE (or lower)
    • file_uploads on (for attachment upload features)
    • session.auto_start needs to be off
    • magic_quotes_gpc off

Running the RoundCube Webmail Installer

The installation of RoundCube used to be a totally manual task, however now they have included a handy installer which not only verifies your environment but also allows you to create your configuration files. You will however still need to manually create a MySQL user and database and ensure that your MySQL user is assigned the approporate priviledges to your RoundCube database. You can use something like PHPMyAdmin to perform this function, or you can look at creating a MySQL user as well as creating a MySQL database and assigning MySQL permissions all from the command line using the MySQL command line client.

Once you have downloaded RoundCube and configured it for use in IIS, the next thing to do is open your web browser and point it to the installer in your RoundCube installation. For example, if your RoundCube installation was located at;

http://example.com/roundcube

You would direct your web browser to;

http://example.com/roundcube/installer/index.php

The first stage of this installer will verify your environment. If anything is picked up here, go back and ensure that all the prerequisites are met as detailed above. The second stage of the installer creates your configuration file, however in most cases you will only need to be enter values for the following;

  • Database server
  • Database name
  • Database user name
  • Database password
  • IMAP host(s)
  • SMTP host

You will also need to ensure the directories specified in the temp_dir and log_dir fields are writable by the IUSR_MACHINENAME user account which is used by IIS for anonymous web access. Once you have entered all your configuration values, press the create button and the installer will display two read only text fields populated with the contents you need to copy and paste into two new configuration files. First, navigate to the config directory in your RoundCube installation on your server and create two files; one called main.inc.php and the other called db.inc.php. Simply copy the contents from the first read only text field in the installer and using your favourite text editor (notepad will do) paste it into main.inc.php, and then do the same again with the second text field into db.inc.php. Save the files so your changes become effective.

The third and final step in the installer is to test your configuration files. Click the continue button underneath the read only text fields and the installer will go ahead and verify your configuration file settings. This will test to make sure both main.inc.php and db.inc.php are present, as well as ensuring that the temp and log file directory you specified in step one are writeable by the server. The installer should also test you database settings and you should see that while the DSN is listed as ok, the DB Schema is listed as not initialised. This is perfectly fine, and just means the RoundCube Webmail database has not yet been populated. Simply press the initialise database button, and if you have set your MySQL privileges correctly it should populate the database. Once you have done this you can also test your SMTP and IMAP settings by sending a test email and connecting to an IMAP account. When you are happy that everything is working, be sure to delete the entire installer directory from your server.

That is it for this article, so hopefully by this stage you have a fully functioning IMAP webmail client using RoundCube Webmail. If you have any feedback or comments about this article, please feel free to post a comment below. If you have specific questions regarding the configuration of your environment then please feel free to start a thread in our forums.

Average rating
(1 vote)

Comments

blazingbiz's picture

Some Issues with Round Cube

Hi,

Thanks for your tutorials, I have PHP 5, MySQL, hmailserver, and Round cube installed on my Win2003 web server after following your instructions. I had a few issues as follows if you could offer any insight I'd appreciate it.

Issues:

OpenSSL

Actually now that I've read more on the subject I see that I have to create some SSL certs and incorporate them into my IIS 6 server, do you have any tutorials on using OpenSSL to create certs and integrate them into IIS 6? I'll be reading the docs on the OpenSSL site but I don't see much that is easy to read.

Adding new email accounts to RoundCube

I was having an issue with this but I resolved this, I must have made some typos with the passwords last time I think.

Brashquido's picture

SSL tutorials are on my todo

SSL tutorials are on my todo list. I've been using a Windows CA for generating all my certificates, so I'll probably aim to create a guide for that first.
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

blazingbiz's picture

In Response

OK,

That sounds good, I'm actually reading up quite a bit about it,actually I've been at it all day - I can probably contribute some info when you are ready and let me know what you would like me to offer.

I had a few questions, when you say "Windows CA", is that a company that you pay for the certs or is that some kind of program or Windows feature? I know about the self-signed cert in the IIS Resource Toolkit, but I like the flexiblity of OpenSSL to create different certs with different cipher keys, so what do you think of those options in comparison?

My other question was in enabling SSL for my RoundCube Web Mail portal, I read that the SSL port for web mail is 993, so I guess if I get a cert installed on IIS and use it for port 443 then I would also need to set it up for port 993 to have my RoundCube login be secure, do you think I should run the entire web mail in an https mode, I know it would be slower but it would protect people's email use on my server. Would i need to edit the main.inc.php config file for RoundCube to set this up as well?

Earlier I wrote about the SMTP authorization settings but then I just read in the hmailserver docs that the SMTP authorization setting is for SMTP relay, so my last question about that was answered, thanks.

Good thing you have an Edit option on these posts, everytime I ask something I go and re-read the docs and answer my own question.

Thanks

Anonymous's picture

IIS Cert with OpenSSL

Check out this article... it should help you with getting that cert for IIS.
http://www.dylanbeattie.net/docs/openssl_iis_ssl_howto.html

I wouldn't worry about secure communication between the mail server and roundcube... after all, they are on the same server... right?

Run the whole roundcube site over 443 using the cert you generated for iis and you should be good.

Good luck!

Anonymous's picture

"HTTP 405 - Resource not allowed"

I've installed and configured PHP, MySQL, and roundcube. I get an OK on everything for the roundcube configuration but when logging in, I get the message The page cannot be displayed "HTTP 405 - Resource not allowed". I've read in several places where you have to change in some places where it says "action = './' to 'index.php' or something like that. I have no idea in which file though. I've tried several with no luck. I've also added index.php to IIS (running 5.1 on XP Pro) as a default document with no luck. I feel like I'm really close to getting this right, but can't get this part figured out. Any help would be great!

Brashquido's picture

Can't say I've ever had that

Can't say I've ever had that problem myself, but then again I'm not using IIS 5.1. I'll have a play around and see if I can replicate it or find any info.

----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Roundcube Login Error

Thanks for the post. I have setup hMailserver, Php and roundcubemail. The test page of Roundcube showed that they were all successful including sending test email(SMTP) and connection to IMAP. The problem I'm having now is that I cannot login, each time I input my username and password on the login page, I get this error: The page cannot be displayed HTTP 405 - Resource not allowed.

Is there anything else I need to do?

Brashquido's picture

Have you made sure that your

Have you made sure that your PHP application mapping in IIS allows the POST HTTP method?

----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Roundcube Login Error

The HTTP 405 is due to IIS 5.1 not being able to handle relative paths in certain situation. To fix this problem, replace all occurrence of action="./" with action="./index.php" That fixed my problem and roundcube is running fine now.

Ola

Anonymous's picture

looking for help

I've been every where from hmailserver to roundcube forums and nobody even responds to my inquiry!

I have the latest stable build of roundcube succesfully installed on my win2k mailserver running (iis) and hmailserver. of course working php5 too.

The install went perfect but I cannot get anything to work after trying to login. I get a "page cannot be displayed" error regardless of what I login with including blank fields.

WTF, I've been scratching my head for weeks trying to figure this out! all php.ini settings are as you state and an fyi that squirrelmail works just fine, so I've got good php install.

shawn