Merak to HMailServer

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
newclick
New user
New user
Posts: 1
Joined: 2004-02-03 12:04
Location: Italy
Contact:

Merak to HMailServer

Post by newclick » 2004-02-03 13:40

I have approximately 100 domains with approximately 150 email and 200 mega of mail on a Merak webserver and wish to pass hmailserver. I must pass to all the email and account by hand or the someone knows a way automatic rifle in order to pass to the email from binary format rows on MySQL or SQL Server?
Matteo Raggi
Fax 003902700515304
Cel 00393200583088

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2004-02-03 20:19

As soon as 3.0 is released, I'll see if it is possible to create a Merak->hMailServer migration tool. Should at least be possible to migrate all domains and accounts.

sherief
New user
New user
Posts: 4
Joined: 2005-08-16 17:12

Post by sherief » 2005-08-17 17:37

I am also trying to migrate all my domains, accounts and messages from Merak 8.0 to Hmailserver and i was wondring if there is a script already for that or if there is a script that i can adapt to use

Thank you

User avatar
Bram
Senior user
Senior user
Posts: 417
Joined: 2004-05-24 22:57
Location: The Netherlands
Contact:

Post by Bram » 2005-08-18 15:33

There is a script available to import users from a text-file. I don't know if it still works with the latest versions of hmailserver.

I will look for it!

--------------------------UPDATE-------------------------------
:( Hmmmzz i can't find it anymore in the forum, maybe Martin knows more. I truly thought there was once a tool like that.
hmailserver 4.3 (242 Live)
hmailserver 5.0 (605 Test)
Windows 2003
MSSQL
ASSP 1.3.2
ClamAV (SOSDG)
http://www.realdesign.nl

sherief
New user
New user
Posts: 4
Joined: 2005-08-16 17:12

Post by sherief » 2005-08-18 16:17

Thanks alot Bram for your help, i hope Martin has the script for me it will help out alot


Thank you

User avatar
Anlan
Normal user
Normal user
Posts: 71
Joined: 2004-11-24 11:09
Location: Bergamo - Italy
Contact:

Post by Anlan » 2005-08-19 19:17

I've built a small VB 6.0 app that extracts domains, email accounts and their passwords from Merak so you can have them written in plain text files.
Anyway we still had an old version of Merak : 5.1.5
Don't really know if subsequent releases of merak had changed something in their APIs. Let me know if it could help you.

boonchuan
New user
New user
Posts: 21
Joined: 2004-05-07 03:32

Post by boonchuan » 2005-08-20 22:06

Martin, really hope you can have a Mailenable to Hmail too : )

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Merak to hmail conversion - what to do with email folders?

Post by matty » 2005-08-22 16:54

I am now writing a VB script that takes a CSV file of account information that I exported from Merak and creates the accounts in hmail. It should work, although I have not tested it yet. If my script works, I will post it here soon.

My question is how do I move the mail folders with the actual emails from my Merak server to my hmail server? The merak server has POP accounts that some users also view via webmail so there is alot of mail in there. Thanks.

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Merak to hmail conversion VB script

Post by matty » 2005-08-22 21:11

Below is the script I mentioned in my last post. It works well. i just used it to convert several hundred domains and over 1,000 email accounts from Merak to hmail. But now I still have the problem of not knowing how to move their physical emails. I am looking to use hmail to replace my existing Merak mail server but if I can't move my existing clients emails then I don't think I can use hmail. Anyone have any ideas on how this can be done:?: Any help here would be greatly appreciated. Even if it is just to tell me this cannot be done!

Code: Select all

Option Explicit

Dim fso, ts, aryFields, firstPos, bolCreated
Dim strDomainName, strUserName, strPassword, strForward, bolRemote, errorMessage

set fso = WScript.CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile("C:\export.txt")

Do While Not ts.AtEndOfStream
	'doing an export in Merak of accounts provides a CSV file
	aryFields = split( ts.ReadLine, ",")

	'Here are the fields we are intereseted in
	'password = col 3
	'domain = col 4 mid up to first \
	'username = col 4 mid after first \ and up to second \
	'forward = col 6 (if col 8 = 0)
	'remote = col 7 (if col 8 = 1)

	firstPos = instr(1, aryFields(3), "\")
	strDomainName = mid(aryFields(3), 1, firstPos - 1)
	strUserName = mid(aryFields(3), firstPos + 1, (instr(firstPos+1, aryFields(3), "\") - 1 - firstPos))
	strPassword = trim(aryFields(2))

	if trim(aryFields(7)) = "1" then
		strForward = replace(aryFields(6), " ", "")
		bolRemote = true
	else
		strForward = replace(aryFields(5), " ", "")
		bolRemote = false
	end if

	errorMessage = ""
	
	bolCreated = createMailbox(strDomainName, strUserName, strPassword, strForward, bolRemote, errorMessage)

	if not bolCreated then msgbox errorMessage
Loop

ts.Close
set ts = nothing
set fso = nothing

function createMailbox(domain, mailbox, password, forward, isRemote, errMsg)
	dim bExists, result, emailAddress
	dim oDomains, oDomain, oAccounts, oAccount, oAliases, oAlias
	dim oRules, oRule, oRuleCriterias, oRuleCriteria, oRuleActions, oRuleAction

	errMsg = ""
	Set oDomains = CreateObject("hMailServer.Domains")

	'Check the domain exists
	on error resume next
	set oDomain = oDomains.ItemByName(domain)
	if err.number <> 0 then
		bExists = false
	else
		bExists = true
	end if
	on error goto 0

	if not bExists Then
		on error resume next
		set oDomain = oDomains.Add()
		oDomain.Active = true
		oDomain.Name = domain
		oDomain.Save
		if err.number <> 0 then
			errMsg = "The domain '" & domain & "' did not exist and I was unable to create it.  The error was '" & result & "'."
			createMailbox = false
			exit function
		end if
		on error goto 0
	End If
	
	emailAddress = mailbox & "@" & domain

	'Check the account doesn't already exist.
	set oAccounts = oDomain.Accounts
	on error resume next
	set oAccount = oAccounts.ItemByName(emailAddress)
	if err.number <> 0 then
		bExists = false
	else
		bExists = true
	end if
	on error goto 0

	if bExists Then
		errMsg = "The '" & emailAddress & "' account already exists"
		createMailbox = false
		exit function
	End If

	' Create the account
	on error resume next
	set oAccount = oAccounts.Add()
	oAccount.Active = true
	oAccount.Address = emailAddress
	oAccount.DomainID = oDomain.ID
	oAccount.Password = password
	oAccount.Save
	if err.number <> 0 then
		errMsg = "Attempt to create account " & emailAddress & " failed with error '" & err.description & "'."
		createMailbox = false
		exit function
	End If
	on error goto 0

	'set up forward or remote rule if a forward email (or semi colon delimited list of emails) exists in Merak
	if forward <> "" then
		'Set a rule on this account that will forward mail to a forward address
		Dim strForwardOrRemote
		if isRemote then
			strForwardOrRemote = "remote"
		else
			strForwardOrRemote = "forward"
		end if
		
		'first we create the actual rule itself
		on error resume next
		set oRules = oAccount.Rules
		set oRule = oRules.Add()
		oRule.AccountID = oAccount.ID
		oRule.Active = true
		oRule.Name = strForwardOrRemote & " " & emailAddress
		oRule.save

		if err.number <> 0 then
			errMsg = "Attempt to create the " & strForwardOrRemote & " address rule failed with error '" & err.description & "'."
			createMailbox = false
			exit function
		End If
		on error goto 0

		'next we create one criteria and one forward action for each address that existed in the forward or remote in Merak
		dim aryForward, i
		aryForward =  split(forward, ";")
		for i = lbound(aryForward) to ubound(aryForward)
			'next we create the criteria for the rule.
			'we use the not contains match to prevent forwarding 
			'multiple copies of emails to the same account if one 
			'of the forward accounts is also in the original email receipient list.
			on error resume next
			set oRuleCriterias = oRule.Criterias
			set oRuleCriteria = oRuleCriterias.Add()
			oRuleCriteria.RuleID = oRule.ID
			oRuleCriteria.UsePredefined = true
			oRuleCriteria.PredefinedField = 7        'recipientList
			oRuleCriteria.MatchType = 6        'not contains
			oRuleCriteria.MatchValue = aryForward(i)
			oRuleCriteria.save
	
			if err.number <> 0 then
				errMsg = "Attempt to set " & strForwardOrRemote & " address rule criteria failed with error '" & err.description & "'."
				createMailbox = false
				exit function
			End If
			on error goto 0

			'next create the action to actually do the forward
			on error resume next
			set oRuleActions = oRule.Actions
			set oRuleAction = oRuleActions.Add()
			oRuleAction.RuleID = oRule.ID
			oRuleAction.Type = 2				'forward email
			oRuleAction.To = aryForward(i)
			oRuleAction.save
	
			if err.number <> 0 then
				errMsg = "Attempt to set " & strForwardOrRemote & " address rule action failed with error '" & err.description & "'."
				createMailbox = false
				exit function
			End If
			on error goto 0
		next

		if isRemote then
			'hmail has no remote address concept and aliases do not allow you to send to more than one address so just use a forward rule and add a delete action at the end
			on error resume next
			set oRuleAction = oRuleActions.Add()
			oRuleAction.RuleID = oRule.ID
			oRuleAction.Type = 1				'delete email
			oRuleAction.save
			
			if err.number <> 0 then
				errMsg = "Attempt to set " & strForwardOrRemote & " address rule failed with error '" & err.description & "'."
				createMailbox = false
				exit function
			End If
			on error goto 0
		end if

	end if

	createMailbox = true
end function

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2005-08-22 21:20

Are you only running POP3 on the old server?
Do you know how messages on that server are stored? One file per message or is it some kind of indexed mailbox file?

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Post by matty » 2005-08-22 21:39

Thanks for the speedy reply! I am running POP3 and webmail on the Merak server. Or more correctly, I was running webmail. The last upgrade Merak recommended stopped my webmail from working and they were unable to get it started again! This is why I am looking for a new email server. I have installed at least 10 trial versions of software, some that were like $8,000, and so far hmail is actually the best one. I have found bugs and problems with all the other software I tried. So far, I have found no problems with hmail and squirellmail, and the best part is it is free! But anyway, I digress.

We now have many agree clients that can't access their webmail. We are trying to get them to access it via POP3 but many still want webmail. I want to move all the mail over to hmail, including webmail folders. Merak stores all mail in the same location whether or not you use webmail, and it creates sub folders if you have folders in webmail, like sent, trash, etc. Each email is just a text file with a .tmp extension. There is no database it is all file based. I have been checking out the hmail database and I see a table called hm_imapfolders, which seems to store the folder names for hmail webmail folders, but there is no matching physical folder. Where does POP3 mail sit on the server until it is picked up? I noticed the folders with two character names under the folder named after the email address of a user. If i move mail there and rename the mail with a .eml extension and create the needed database entries in the messages table and folders table would that work? Or does the file name and folder name mean something to the system? Any ideas? Thanks again!

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2005-08-22 21:44

> Where does POP3 mail sit on the server until it is picked up?

In the hMailServer data directory. The messagefolderid column in the database is 0 when it's in the inbox. And when you connect using POP3, you download messages from the inbox.

> If i move mail there and rename the mail with a .eml extension and create the needed database entries in the messages table and folders table would that work

If you simply put the files in the \hMailServer\Data\Domain.com\username folder and then add the message to the database (and then restart the server) it's enough. You don't have to create the "2 character sub folder" to the "username" folder. The reason that this exist is simply that if you have to many messages in the same folder, you might get performance issues.

Actually, you don't have to manually insert the rows into the hm_messages table. This can be done automatically using DataDirectorySynchronizer (DDS), if you're using the latest hMailServer version. Simply put the files in the user folders, and run DDS. DDS will go through all the user folders and insert the files into the database. DDS is found here:
C:\Program Files\hMailServer\Addons\DataDirectorySynchronizer

However, this way all messages will be put in the users INBOX folders. DataDirectorySynchronizer doesn't support creating IMAP folders, such as Draft, Sent Items and so on. :-\

Also, it's important that the .tmp files is actually raw email messages. If you post one of them here I can tell you whether they are or aren't..

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Post by matty » 2005-08-22 22:22

However, this way all messages will be put in the users INBOX folders. DataDirectorySynchronizer doesn't support creating IMAP folders, such as Draft, Sent Items and so on. :-\
What if I write a script that manually creates entries in the hm_imapfolders table that correspond to the merak folders, then where would I physically put the messages? Is the inbox the same for Imap and POP email - meaning if I move POP mail as you explained and run that DataDirectorySynchronizer utility, and someone checks their email via web mail, will the mail be there or is that only for POP accounts?
Also, it's important that the .tmp files is actually raw email messages. If you post one of them here I can tell you whether they are or aren't..
Here is a spam one of our clients received - I only removed info that identifies him and replaced it with *. Other than that it is the entire original .tmp file that was in his folder on the merak mail server. Let me know if this is the correct type of email file. THANKS AGAIN!!!

Code: Select all

Received: from 62.193.230.162 ([62.193.230.162])
        by mail.********.com (Merak 8.0.2) with SMTP id ECO74830
        for <******@*******.com>; Mon, 07 Mar 2005 18:39:11 -0500
Received: from 138.50.132.126 by ; Mon, 07 Mar 2005 21:31:53 -0200
Message-ID: <ZHBBVZZDOMIEBULGBXTSCJ@yahoo.com>
From: "Wamu Team" <Support@Wamu.com>
Reply-To: "Wamu Team" <Support@Wamu.com>
To: *****@******.com
Subject: Wamu Bank
Date: Tue, 08 Mar 2005 00:32:53 +0100
X-Mailer: MIME-tools 5.503 (Entity 5.501)
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="--3597987942794085765"
X-Priority: 1
X-MSMail-Priority: High

----3597987942794085765
Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable

<html>

<head>
<meta http-equiv=3D"Content-Language" content=3D"en-us">
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dwindows-=
1252">
<style>
<!--
#message td {font-family: verdana,arial,helvetica,sans-serif;font-size:
12px;color: #000000;}
#message .pp_heading {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
18px;font-weight: bold;color: #003366;}
#message .pp_sansserif{font-family: verdana,arial,helvetica,sans-serif; 
font-size:
16px;color: #000000;}
#message hr.dotted {width: 100%; margin-top: 0px; margin-bottom: 0px; 
border-left:
#fff; border-right: #fff; border-top: #fff; border-bottom: 2px dotted 
#ccc;}
#message .pp_footer {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
11px;color: #aaaaaa;}
-->
</style>
</head>

<body>

<table class=3D"messageheader" cellSpacing=3D"0" cellPadding=3D"0" width=3D=
"100%" 
border=3D"0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<div id=3D"message" style=3D"font-family: verdana,arial,helvetica,sans-ser=
if; 
font-size: 12px;
color: #000000">
  <xmeta Content=3D"Microsoft DHTML Editing Control" NAME=3D"GENERATOR" />=

  <xbody />
  <style type=3D"text/css">
#message .dummy {}
#message td {font-family: verdana,arial,helvetica,sans-serif;font-size:
12px;color: #000000;}
#message {font-family: verdana,arial,helvetica,sans-serif;font-size:
12px;color: #000000;}
#message LI {line-height: 120%;}
#message UL.ppsmallborder {margin:10px 5px 10px 20px;}
#message LI.ppsmallborderli {margin:0px 0px 5px 0px;}
#message UL.pp_narrow {margin:10px 5px 0px 40px;}
#message hr.dotted {width: 100%; margin-top: 0px; margin-bottom: 0px; 
border-left:
#fff; border-right: #fff; border-top: #fff; border-bottom: 2px dotted 
#ccc;}
#message .pp_label {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
10px;font-weight: bold;color: #000000;}
#message .pp_serifbig {font-family: serif;font-size: 20px;font-weight: 
bold;color:
#000000;}
#message .pp_serif{font-family: serif;font-size: 16px;color: #000000;}
#message .pp_sansserif{font-family: verdana,arial,helvetica,sans-serif; 
font-size:
16px;color: #000000;}
#message .pp_heading {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
18px;font-weight: bold;color: #003366;}
#message .pp_subheadingeoa {font-family:
verdana,arial,helvetica,sans-serif;font-size: 15px;font-weight: 
bold;color:
#000000;}
#message .pp_subheading {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
16px;font-weight: bold;color: #003366;}
#message .pp_sidebartext {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
11px;color: #003366;}
#message .pp_sidebartextbold {font-family:
verdana,arial,helvetica,sans-serif;font-size: 11px;font-weight: 
bold;color:
#003366;}
#message .pp_footer {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
11px;color: #aaaaaa;}
#message .pp_button {font-size: 13px; font-family:
verdana,arial,helvetica,sans-serif; font-weight: 400; border-style:outset;=

color:#000000; background-color: #cccccc;}
#message .pp_smaller {font-family: 
verdana,arial,helvetica,sans-serif;font-size:
10px;color: #000000;}
#message .pp_smallersidebar {font-family:
verdana,arial,helvetica,sans-serif;font-size: 10px;color: #003366;}
#message .ppem106 {font-weight: 700;}
  </style>
  <table cellSpacing=3D"0" cellPadding=3D"0" width=3D"600" align=3D"center=
" 
border=3D"0">
    <tr vAlign=3D"top">
  <table cellSpacing=3D"0" cellPadding=3D"0" width=3D"100%" border=3D"0">
    <tr>
      <td width=3D"100%" style=3D"font-family: 
verdana,arial,helvetica,sans-serif; font-size: 12px; color:
#000000">
      <img height=3D"10" src=3D"http://images.paypal.com/images/pixel.gif"=
 
width=3D"1"
border=3D"0"></td>
    </tr>
  </table>
  <table cellSpacing=3D"0" cellPadding=3D"0" width=3D"600" align=3D"center=
" 
border=3D"0">
    <tr vAlign=3D"top">
      <td width=3D"400" style=3D"font-family: 
verdana,arial,helvetica,sans-serif; font-size: 12px;
color: #000000">
      <table cellSpacing=3D"0" cellPadding=3D"5" width=3D"100=
%" border=3D"0">
        <tr vAlign=3D"top">
          <td style=3D"font-family: verdana,arial,helvetica,sans-serif; 
font-size: 12px; color:
#000000">
          <table cellSpacing=3D"0" cellPadding=3D"0" width=3D"100=
%" border=3D"0">
            <tr>
              <td class=3D"pp_heading" align=3D"left"><br>
              Security Center Advisory!</td>
            </tr>
          </table>
          </td>
        </tr>
        <tr>
          <td style=3D"font-family: verdana,arial,helvetica,sans-serif; 
font-size: 12px; color:
#000000">
          <p><br>
                Washington Mutual is committed to maintaining a safe 
environment 
                for its community of buyers and sellers. To protect the 
security 
                of your account, Washington Mutual employs some of the 
most advanced 
                security systems in the world and our anti-fraud teams 
regularly 
                screen the Washington Mutual system for unusual 
activity.<br>
                <br>
                We recently have determined that different computers have =

logged 
                onto your Washington Mutual Online Banking account, and 
multiple 
                password failures were present before the logons. We now 
need 
                you to re-confirm your account information to us. If this =

is not 
                completed by <strong>10 February, 2005</strong>, we will 
be forced 
                to suspend your account indefinitely, as it may have been =

used 
                for fraudulent purposes. We thank you for your cooperation=
 
in 
                this manner. <br>
                <br>
                In order to confirm your Online Bank records, we may 
require some 
                specific information from you.<br>
                <br>
                <br>
                Please follow the link below and renew your account 
information 
                : <br>
                <br>
                <br>
		    <a 
href=3D"http://203.250.32.123/images/.wamu/update.html"  
onMouseOver=3D"window.status=3D'https://login.personal.wamu.com/logon/logo=
n.asp?dd=3D1&Update&Your&Info';return 
true;" 
    onMouseOut=3D"window.status=3D' ';return 
true;">https://login.personal.wamu.com/logon/logon.asp?dd=3D1&Update&Your&=
Info</a>
                <br>
                <br>
                Thank you for your prompt attention to this matter. Please=
 
understand 
                that this is a security measure meant to help protect you =

and 
                your account. <br>
                <br>
                We apologize for any inconvenience.<br>
                <br>
                If you choose to ignore our request, you leave us no 
choise but 
                to temporaly suspend your account.<br>
                <br>
                Thank you for using Washington Mutual!</p>
              </td>
        </tr>
        <tr>
          <td style=3D"font-family: verdana,arial,helvetica,sans-serif; 
font-size: 12px; color:
#000000">
          <hr class=3D"dotted"></td>
        </tr>
        <tr>
          <td style=3D"font-family: verdana,arial,helvetica,sans-serif; 
font-size: 12px; color:
#000000">
          <table cellSpacing=3D"0" cellPadding=3D"0" width=3D"100=
%" border=3D"0">
            <tr>
              <td style=3D"font-family: verdana,arial,helvetica,sans-serif=
; font-size: 12px;
color: #000000">
              <img height=3D"10" src=3D"http://images.paypal.com/en_US/i/s=
cr/pixel.gif" width=3D"1"
border=3D"0"></td>
            </tr>
          </table>
          </td>
        </tr>
        <tr>
          <td style=3D"font-family: verdana,arial,helvetica,sans-serif; fo=
nt-size: 12px; color:
#000000">&nbsp;</td>
        </tr>
      </table>
      </td>
    </tr>
  </table>
</body>

</html>



----3597987942794085765--

.

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2005-08-22 22:37

What if I write a script that manually creates entries in the hm_imapfolders table that correspond to the merak folders, then where would I physically put the messages?
Sure, that would work. hMailServer caches IMAP folders in memory for performance reasons, but if you just restart the service after you've added the data to the database, it should work fine..
Is the inbox the same for Imap and POP email
Yes. In the hm_messages table, there's a column (messagefolderid) that says which folder the message exists in. If this column contains 0, this means that the message is in the inbox. This inbox is the same both for IMAP and for POP3.

If you're doing direct manipulations in the hm_imapfolders table, you should now that you should never put an "INBOX" folder in this table. Since all accounts always have an inbox, and this folder always has "messagefolderid=0", this folder is created automatically in memory. If you add an "INBOX" folder to the hm_imapfolders table, you'll have two INBOX folders with the same name (which no client will be able to handle properly).

Hmm. In the last line of that message, there's a dot. In the hMailServer format, this dot isn't there. When a SMTP server deliveres a message to another SMTP server, it uses a dot on an empty line to indicate "end of data transfer". Since this dot isn't really a part of the email message, hMailServer doesn't store it in the data file. You should check a couple of other messages to see if all of them ends with a dot...

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Post by matty » 2005-08-23 18:15

Thanks Martin! HMailServer kicks ass! I did a test on one account. I copied all the mail from the merak user's folder (including subfolders) into the corresponding user folder for hmail. Then I renamed all the file extensions from .tmp to .eml and ran the DataDirectorySynchronizer which created all the needed entries in the hm_messages table. At this point the users inboxes are all transfered and ready to go. Then I just had to create IMAP folders in the hm_imapfolders table and then go through any messages in the hm_messages table that were in IMAP folders in Merak and assign them to the correct IMAP folder ID that I created in the previous step. I restarted hmail server and logged in to web mail as my test user and all the folders were there with the email in the correct folders. Now I am goign to see if I can write a script to automate this process for all my accounts. If I get it to work I will post here for anyone else converting from Merak to hmail.

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2005-08-23 18:17

Is your Merak installation running only with POP3? No IMAP?

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Post by matty » 2005-08-23 22:40

It is currently only running POP3. It used to have a webmail component but as I stated earlier in this thread, it has not been working for a few weeks. I am not an expert on IMAP but I guess we must have had it running to use webmail since that is the protocol that web mail works on right? But either way it aint working anymore! Just curious, why do you ask?

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2005-08-23 22:44

Because if it were running IMAP, you would have been able to copy all the email messages using a tool called IMAPCopy. In IMAPCopy you can define a list of from-accounts and to-accounts. Then when you run the tool it copies all IMAP folders and IMAP messages automatically. Would perhaps have been easier than writing a tool to do it.. :)

You almost always use IMAP when you're using webmail, but there are webmail systems that works with POP3 as well..

associates
Normal user
Normal user
Posts: 162
Joined: 2006-01-30 04:48

Post by associates » 2006-02-01 03:43

Hi, Martin

I have been using merak mailserver for 2 years already and using it for IMAP, not POP3. And i'd like to use Hmailserver instead because i think it's a great product. I've got two questions here.

1. I've been following up this thread here and interested in it. When you mentioned about IMAPCopy tool, does it come with HMailServer already?

2. At the moment, i'm having approximately 1500 email messages sitting on merak and i know that this's not a very good idea as it'd slow down the performance of loading up all the messages when logging to webmail.
My question is there is a maximum limit in the number of messages for HMailServer to handle?

Thank you very much in advance

associates
Normal user
Normal user
Posts: 162
Joined: 2006-01-30 04:48

Post by associates » 2006-02-02 03:35

Hi again

I was wondering if anyone might be able to help me understand this whole process of migrating merak to Hmailserver.

1. Why do we need to change from .tmp to .eml file extension is needed while migrating to Hmailserver?

2. I notice that most of my user folders's email messages are of .imap file extension, not .tmp, what does .tmp file extension refer to?

Your help is greatly appreciated. Thank you very much in advance and look forward to hearing from you guys.

iprat
Normal user
Normal user
Posts: 247
Joined: 2005-05-20 16:50
Location: Barcelona, EU
Contact:

Post by iprat » 2006-02-02 12:26

associates wrote:1. I've been following up this thread here and interested in it. When you mentioned about IMAPCopy tool, does it come with HMailServer already?
2. At the moment, i'm having approximately 1500 email messages sitting on merak and i know that this's not a very good idea as it'd slow down the performance of loading up all the messages when logging to webmail.
My question is there is a maximum limit in the number of messages for HMailServer to handle?
Answer to 1:
No, IMAPCopy is not included in hMailServer. Just google around and you'll find it it's a small aplication here: http://home.arcor.de/armin.diehl/imapcopy/imapcopy.html

Answer to 2:
I have 900 messages on my inbox and 2700 on my sent folder, among other folders. hMailServer has no significant messages limit on this.
On the other side if you webmail supports server side sorting (squirrelmail does) this will speed up things when opening those folders as hMailserver supports IMAP server sorting.
My perfect combination:
hMailServer 5.6.1 (B2208), ASSP 1.3.3.8 (antispam), Clamav 0.98.6 (antivirus)

iprat
Normal user
Normal user
Posts: 247
Joined: 2005-05-20 16:50
Location: Barcelona, EU
Contact:

Post by iprat » 2006-02-02 12:30

associates wrote:1. Why do we need to change from .tmp to .eml file extension is needed while migrating to Hmailserver?

2. I notice that most of my user folders's email messages are of .imap file extension, not .tmp, what does .tmp file extension refer to?
Just use IMAPCopy and make a test with one user and you will see that this is not any problem as in IMAP protocol (which is how IMAPCopy works) it doesn't matter how the servers store the messages as the copy is done in the standard IMAP language, so you don't have to care if Merak stores things in .tmp and hMailServer stores them in .eml.

It is highly encouraged to make in this way to avoid having to face the problems of adapting to diferent message databases between two diferent email servers. This is the great success of IMAPCopy, if the servers are IMAP compatible IMAPCopy can copy your entire message in the new server.
My perfect combination:
hMailServer 5.6.1 (B2208), ASSP 1.3.3.8 (antispam), Clamav 0.98.6 (antivirus)

iprat
Normal user
Normal user
Posts: 247
Joined: 2005-05-20 16:50
Location: Barcelona, EU
Contact:

Post by iprat » 2006-02-02 12:36

I forgot to say that it is recommended to use the stable version 4.1.1 build 140, but you might consider using the speed optimitzations (specially server side sorting) of the "de facto" stable (one of this days will be) 4.2 build 193 or later. There are a lot of production sites using build 193.
My perfect combination:
hMailServer 5.6.1 (B2208), ASSP 1.3.3.8 (antispam), Clamav 0.98.6 (antivirus)

associates
Normal user
Normal user
Posts: 162
Joined: 2006-01-30 04:48

Post by associates » 2006-02-03 05:52

HI Iprat,

Thank you for your help with my problem.

I have done as you told me. However, it's not working yet as it did not quite copy all the mails across. Just wonder if you have used this product before.

I made some changes in the imapcopy.cfg as follows

##############
# Sourceserver
##############
SourceServer sourceserver.domain.com.au
SourcePort 143

###################
# Destinationserver
###################
DestServer destserver.domain.com.au
DestPort 143


#########
# Options
#########
#
# DebugSrc and DebugDest will show all traffic between IMAPCopy and Server
#
#DebugSrc
#DebugDst


#################
# Folders to skip
#################
#skipfolder INBOX.Trash
#skipfolder INBOX.Sent
#skipfolder "INBOX.Sent Objects"


#################
# Folders to copy
#################
copyfolder INBOX
#copyfolder "INBOX.My personal files"
#copyfolder INBOX.Net-Connection.dy
#copyfolder INBOX.test


#######################################################
# Rootfolder
# Can be specified to copy the Folder-Structure under
# a separate folder instead of inbox
#######################################################
#DstRootFolder "Your old Mails"


############################################################
# Specify Flags that are supported on the destination server
# If not specified, all Flags are copyied 1:1
# If specified, all non specified Flags are deleted and not
# copied to the destination
############################################################
#AllowFlags \Seen\Answered\Flagged\Deleted\Draft


#############################
# List of users and passwords
#############################
# SourceUser SourcePassword DestinationUser DestinationPassword
Copy "user1" "passwd" "user1@pbj.com.au" "passwd"
#Copy "bar" "barsrcpw" "bar" "test"

But i have a bad feeling here. How does imapcopy know where to copy the mails to? i haven't specified it anywhere yet. where do i do it?

Thank you very much for your patience and help and look forward to hearing from you

iprat
Normal user
Normal user
Posts: 247
Joined: 2005-05-20 16:50
Location: Barcelona, EU
Contact:

Post by iprat » 2006-02-03 10:37

Well I think that is all what ImapCopy needs, don't you think ?

Source server (1), destination server (2), and a list of users and pass for each server (3):

(1)
SourceServer sourceserver.domain.com.au
SourcePort 143

(2)
DestServer destserver.domain.com.au
DestPort 143

(3)
# SourceUser SourcePassword DestinationUser DestinationPassword
Copy "user1" "passwd" "user1@pbj.com.au" "passwd"

I think that all info needed is provided.
My perfect combination:
hMailServer 5.6.1 (B2208), ASSP 1.3.3.8 (antispam), Clamav 0.98.6 (antivirus)

associates
Normal user
Normal user
Posts: 162
Joined: 2006-01-30 04:48

Post by associates » 2006-02-09 09:46

Hi Iprat,

You're right, Nothing else to put in there. However, i still don't get to see anything changed in my inbox in terms of the amount of emails. As far as the result is concerned, everything looks like working. I have compared the result when running the command "imapcopy -t" on the dos command against the sample result shown on the website where i downloaded the imapcopy from. Strange.

Login on sourceserver as user1 OK
Login on destinationserver as user1@mydomain.com.au OK
Getting folderlist on sourceserver OK, found 4 folder

1 User processed, 0 Messages copied, 0 Error(s)
0 Folder(s) created, 0 Folder create errors, 0 Folder not copied

If it worked, why is it 0 folder created?.

YOur help is greatly appreciates and thank you in advance

iprat
Normal user
Normal user
Posts: 247
Joined: 2005-05-20 16:50
Location: Barcelona, EU
Contact:

Post by iprat » 2006-02-09 11:03

If it is able to login and eveything works fine (at least for the log I see) I can only imagine two possibilites:

1) You have accidentally reversed the order of the servers and you are trying to copy from the new to the old server. I believe this could be possible because you login to the server but IMAP does not find anything to copy:

1 User processed, 0 Messages copied, 0 Error(s)
0 Folder(s) created, 0 Folder create errors, 0 Folder not copied

2) Your old server supports IMAP but you have downloaded all mail in POP3 and then there is no mail.
My perfect combination:
hMailServer 5.6.1 (B2208), ASSP 1.3.3.8 (antispam), Clamav 0.98.6 (antivirus)

associates
Normal user
Normal user
Posts: 162
Joined: 2006-01-30 04:48

Post by associates » 2006-02-10 06:44

Hi Iprat,

That's alright. Not sure what caused it. But i'm not sure if i had accidentally done like you described as the first possible cause unless i misinterpreted the source with the destination.

I think I can't put this off any longer. I guess, I will have to use the longer way like Matty did. But if i was to do that, can i check with you one thing? since my current/old mailserver is running IMAP, i have to rename all the file extensions from .imap to .eml, don't i?. Why does it have to be .eml, not leave it as they are (.imap)?

Thank you in advance

iprat
Normal user
Normal user
Posts: 247
Joined: 2005-05-20 16:50
Location: Barcelona, EU
Contact:

Post by iprat » 2006-02-10 12:59

I am sorry to say I can't help you with that. If you have every message stored as .imap you may rename them to .eml and try to move them manually once users are created in the new server. But this needs the sincronizer tool wich I have never used so I'm afraid I can't help.

Anyway from the logs you sent, I'm conviced that IMAPCopy must work if configured correctly.

When I migrated from Mercury to hMailServer I just copied a 5 accounts by opening two accounts on Outlook Express and moving messages from Outlook Express manually (select all and drag&drop them to the new server folder). In fact later I discovered that this is exactly what IMAPCopy does automatically. I tested and worked, but I have only done this once and it was quite a long time ago, as since I work with hMailServer I have not had any need to change again the server ;)
My perfect combination:
hMailServer 5.6.1 (B2208), ASSP 1.3.3.8 (antispam), Clamav 0.98.6 (antivirus)

User avatar
martin
Developer
Developer
Posts: 6834
Joined: 2003-11-21 01:09
Location: Sweden
Contact:

Post by martin » 2006-02-10 13:07

> 1 User processed, 0 Messages copied, 0 Error(s)
> 0 Folder(s) created, 0 Folder create errors, 0 Folder not copied
> If it worked, why is it 0 folder created?.

Because the Inbox folder already exists on the target server? Even on a newly created IMAP account there's an inbox folder. If it already exists, it would seem reasonable that it just skipped it. The Inbox folder is special in that way.

Do you have any email in the folder which wasn't copied?

associates
Normal user
Normal user
Posts: 162
Joined: 2006-01-30 04:48

Post by associates » 2006-02-11 04:35

Thanks a lot to you both, Iprat and Martin for your reply.

That's allright, Iprat. You've done all you could. I understand it. It's just me that i'm not sure of what i'm doing. This whole thing is a new experience for me. I'd really be keen to learn from it.

Martin, when you said that this might be due to the fact that the inbox that i want to copy into already exists in my new mailserver i.e. HMailServer (the target server). This really got me thinking. It'd be possible too. But i'd try it on monday next week.

Do you have any email in the folder which wasn't copied?
Hmmm... as far as i can see, nothing gets transfered or copied. I mean the whole folder of inbox. In my older server i.e. merak, there are four folders and they are inbox, sent, trash, and deleted. For testing, i want to copy only the inbox folder (that's why i let it skip the other folders) but it fails to do so.

Anyway, let me try this i.e. to remove all the folders exist in my HMailserver (target server) and from there, i run the imapcopy once again.

Thanks very much. I'd really appreciate your help. I'll let you know the result.

associates
Normal user
Normal user
Posts: 162
Joined: 2006-01-30 04:48

Post by associates » 2006-02-13 09:07

Hi Martin,

I have tried to make sure there is no Inbox on the target server i.e. HMailserver. The same result came up, no changes was detected as far as the result details is concerned.

I did all i could such as turning off the firewall on both server, old and the new server.

By the way, both of them run on windows XP. I don't think this is due to the operating system.

Thank you in advance

plobby
Normal user
Normal user
Posts: 115
Joined: 2008-01-29 07:04

Post by plobby » 2008-02-28 00:14

This thread is pretty old, and I am unsure if Matty still posts here...Did you ever happen to get around to writing the script that would do the whole process for you? I am currently trying to do the same but with about 60 accounts and around 10,000 messages...

It is running the latest version of merak (9.1.0) with IMAP and POP on all the accounts. POP for the outlook clients and imap for the webmail clients.

I am going to try and play with the method above and hope the script you wrote for importing/exporting the accounts will work.

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Post by matty » 2008-02-29 16:20

I posted the script earlier in the thread .... It was a long time ago and I don't remember all of what I did but I think i used that script pretty much to create the accounts and then used IMAPcopy like Martin suggested to move the actual emails over.

plobby
Normal user
Normal user
Posts: 115
Joined: 2008-01-29 07:04

Post by plobby » 2008-02-29 19:03

Alright, thank you very much.

User avatar
matty
Senior user
Senior user
Posts: 330
Joined: 2005-08-22 16:29
Location: New York
Contact:

Post by matty » 2008-03-01 02:36

sorry I don't remember more... but one point - if you are on a new version of hmail, not all of my script is correct. For example I think I created rules to do forwarding but now there is a forward built in to hmail accounts. There may be other "legacy" things in the API that may need tweaking but if you are handy with VB Script you should be able to tweak it and use IMAP copy to achieve what you want. I think I first was trying to physically copy the email files and update the database in hmail but it was not working correctly so I switched to IMAP copy which copied the mail for me. Good Luck! And don't worry you won't miss Merak - I never looked back and have been happy with hmail ever since.

metay
New user
New user
Posts: 3
Joined: 2008-12-05 15:21

Re: Merak to HMailServer

Post by metay » 2009-05-29 12:16

hi,

this is export code for merak mail server
tool export account *@* u_password u_forwardto > c:\merak.txt

and atach file is import tool hmailserver (VB6 source and exe)
Attachments
meraktohmail.rar
New import tool merak mail server exprot file to hmail server.
fix buq
(8.84 KiB) Downloaded 404 times
hmail.rar
import tool merak mail server exprot file to hmail server.
(9.85 KiB) Downloaded 398 times

Post Reply