- Hmailserver uses a db to save the path to EVERY email. If u change the dir, u HAVE TO change the content of the db.
- mysql isnt shipped anymore with hmailserver
- Hmailserver sets up envirometnal variables, which are cheesy to edit by hand.
Lets get started.
Backup your datadirectory, your hmailserver.ini and your database for safety reasons.
If you dont do that allready on a regular basis - START NOW. You will find your directories most likely in the hmailserver installation folder. It should be something like c:\program files (x86)\hmailserver\data and bin.
Hint: For data backup, use CobianBackup. For your mysql server either use phpmyadmin, or mysqldumper (which is pretty powerful backup solution written in php)(couldnt find english version right now).
After the backup of the database, rename the hmailserver table to whatsoever. We will use it later again.
Because HMailserver sets some enviromental variables it is way more easy to deinstall the server and do a new setup on the prefered drive, than changing everything by hand.
Load the latest stable version from http://www.hmailserver.com and install it on your prefered drive..
Follow the guide, till it asks you for your db solution. As mentioned above this minitut is going to use mysql.
Choose to create a new database, since we will use the old one anyways. (I couldnt use the second option it just kept quitting without mentioning what went wrong).
The wizard will ask you for your login data.
Commonly its localhost (try 127.0.0.1 if localhost wont work) and the preset port. Use your username and password, as well as a databasename. The database will be created by hmailserver.
HMailserver will now try to connect to the database and will most likely fail. This is because of the closed source policy of mysql. Hmailserver is not shipped with the necessary libmysql.dll anymore. Copy the dll from your local Apache setup configuration to the your new hmailserver/bin folder. Do not use the libmysql.dll which is sometimes shipped with windows. It will not work. If you are using xampp or something similar, search the mysql/bin folder.
Try to reconnect to the db and be patient. If the connection error still apears, check the screen output (seriously) and/or check your username and password for the db.
Set up the necessary login data for your hmailserver adminpanel.
Acquiring new data path.
Go to your new hmailserver folder and open the hmailserver.ini. Check the line with the datadirectory. Copy the path, we will need it change our old database.
Changing your database.
Use this simply and dirty script to change your database (the old 1, u renamed in before).
Code: Select all
<? $old_path = 'd:\hMailServer\Data'; // do not end on a backslash here, it will cause errors if unescaped $new_path = 'd:\hMailServer\Data'; // do not end on a backslash here, it will cause errors if unescaped $link = mysql_connect("localhost", "username", "password") // your connection data here or die("No connection possible: " . mysql_error()); mysql_select_db("hmailserver") or die("db selection failed"); // your dbname here $change_data = mysql_query(" UPDATE hm_messages SET messagefilename=REPLACE(messagefilename,'".mysql_real_escape_string($old_path)."','".mysql_real_escape_string($new_path)."') ") or die(mysql_error());
Rename your changed old db to be the new one. Use the db_updater located in the hmailserver directory to get it up to date.
Done. Start HmailServer.