Migration case - there is a way to import user accounts from .CSV?

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
jr3151006
Normal user
Normal user
Posts: 31
Joined: 2011-02-03 14:57

Migration case - there is a way to import user accounts from .CSV?

Post by jr3151006 » 2014-12-08 23:23

I exported the user accounts from my old server with MYSQL, make some adjustment on the .CSV file and them imported it on the new server with MS-SQL, after that I changed the PASSWORD and seems to be fine.

But when I logged with these accounts (Roundcube interface), shows a msg like 'folder not found'.

>>> There is a way to import direct from HMAIL instead from MS-SQL as I tested?

tks,

Renato P

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Migration case - there is a way to import user accounts from .CSV?

Post by percepts » 2014-12-08 23:39

was your old server using hmail? If so then you should do a backup using hmail built-in backup using compression.
Then restore to new server using same version of hmail. And then upgrade hmail if it was older version.

(hmail built in backup outputs to xml and will restore to any of the hmail database types providing hmail version is same as in backup)

If old server was not hmail then you must use some imap sync software to move data. Something like IMAPSYNC or http://home.arcor.de/armin.diehl/imapcopy/

You can load user account information (but not mail) using viewtopic.php?f=20&t=24810&sid=9ff512c2 ... 18#p151855

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Migration case - there is a way to import user accounts from .CSV?

Post by percepts » 2014-12-08 23:52

ALSO

if old server was pre hmail version 5.4 then install location of hmailserver/data must be exact same path as on old server because absolute filepaths were used in pre 5.4 hmail. From 5.4 relative paths are used so you can put hmailserver/data folder anywhere providing hmailserver.ini points to it.

jr3151006
Normal user
Normal user
Posts: 31
Joined: 2011-02-03 14:57

Re: Migration case - there is a way to import user accounts from .CSV?

Post by jr3151006 » 2014-12-09 13:48

Hi Percepts,

tks for quick reply but since the servers are different (OLD = W2003 + MySQL + v5.3 / NEW = W2012 + MS-SQL + v5.6) I´m not able to use the BUILT-IN Backup feature.

For this case, I'm just trying to create a lot of mailboxes quickly and I already used another tool (freeware) to migrate the IMAP Folder Structure as my old post (viewtopic.php?f=7&t=27287).

>>> I'll check the script in .VBS on the link that you post.

tks,

Renato P

User avatar
mattg
Moderator
Moderator
Posts: 21113
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Migration case - there is a way to import user accounts from .CSV?

Post by mattg » 2014-12-09 14:30

jr3151006 wrote:tks for quick reply but since the servers are different (OLD = W2003 + MySQL + v5.3 / NEW = W2012 + MS-SQL + v5.6) I´m not able to use the BUILT-IN Backup feature.
If the hmailserver versions were the same, and the database size was small enough, the backup >> restore should work fine
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Migration case - there is a way to import user accounts from .CSV?

Post by percepts » 2014-12-09 14:53

an sql dump of the correct format with one db row per insert should be easily editable to MSSQl format for a simple load.
BUT it should be to same version of hmail as DB layout changes between major versions.

BUT it would be even easier if you retore to same version using hmail backup

jr3151006
Normal user
Normal user
Posts: 31
Joined: 2011-02-03 14:57

Re: Migration case - there is a way to import user accounts from .CSV?

Post by jr3151006 » 2014-12-09 17:11

I was able to use your script to create new user, but right now I´m interested in how to export user accounts with all properties/parameters, from the old server to a file and then import on the new server.

As a second step, migrate contents with IMAPCOpy tool.

tks,

Renato P

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Migration case - there is a way to import user accounts from .CSV?

Post by percepts » 2014-12-09 17:38

to make this whole process easier and less time consuming for us volunteers it would be helpful if you could do the following:

Run hmail backup on old system using all backup options including compression.

When you have done that let us know.

jr3151006
Normal user
Normal user
Posts: 31
Joined: 2011-02-03 14:57

Re: Migration case - there is a way to import user accounts from .CSV?

Post by jr3151006 » 2014-12-09 21:36

But the backup will be restored at the new server?
The restore will reset all domain/account that already exists on the new server?

tks,

Renato P

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Migration case - there is a way to import user accounts from .CSV?

Post by percepts » 2014-12-09 21:58

correct but you didn't say you had data in new server or that you wanted to "merge" two servers data.

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Migration case - there is a way to import user accounts from .CSV?

Post by percepts » 2014-12-09 22:05

in that case you can do an sql dump of table hm_accounts using dump format of 1 row per insert. Then edit that file down into csv format for the script I pointed you at.

Then as for imapcopy you will have to follow their instructions. I never used it.

jr3151006
Normal user
Normal user
Posts: 31
Joined: 2011-02-03 14:57

Re: Migration case - there is a way to import user accounts from .CSV?

Post by jr3151006 » 2014-12-10 18:11

Percepts,

I´ll work on a script to dump all settings from old HMAIL's domains/accounts and also prepare as .CSV for your script.

tks,

Renato P

Post Reply