Migrating from qmail toaster

I’d like to migrate accounts from qmail toaster over to interworx. It uses qmail and vpopmail also, but vpopmail is under /home/vpopmail instead of /var/vpopmail. Also under the user accounts in the maildir folder there is 2 additional folders on the interworx server, .Learn Ham and .Learn Spam. So the question is can i just copy the user folders over to interworx and recreate the .Learn Ham and .Learn Spam folders or should i recreate the users and just copy over the messages? What’s the easiest way? Any help would be greatly appreciated. Thanks.

rferrigno,

You’ll need to setup the e-mail accounts in IWorx-CP first so that the user login info is in the vpop db. After that you should be good to copy over Maildirs from the old box to the new. The “learn” directories are specific to the spam filtering that iworx-cp uses and they are optional. Leaving them there is probably the best bet.

Chris

Bulk email account creation

Thanks for the response Chris. Next question would be if there is a bulk mail account creation utility or script. Thanks again.

Once you have the siteworx account setup you can use the “vadduser” vpopmail binary to add users just as you would under the toaster. You can script based on that pretty easily.

Chris

vadduser script

Thanks Chris. I got the import working very nicely. If some one knows an easy way to export from a qmail toaster please feel free to share. It would come in handy for someone trying to migrate hundreds of accounts. Here is the import info. works like a charm.

Create a File containing the data to be imported in tab delimited format

-------------------------------------------------------------------------------cut

This is a sample bulkload file. Columns are separated by TABS.

#Remove this header before running the perl script

format: email password fullname

vince@domain.com mypassword Vince Hughs
idan@domain.com password Idan Green
-------------------------------------------------------------------------------cut

Then run this perl script to import the data and create accounts using vadduser

---------------------------------------------------------------------------------cut
#!/usr/bin/perl
open (in,addemail) || die “cannot open file $filename: $!”;

while(<in>){
#chop($);
@VARS = split(/ /,$
);
$USERNAME = $VARS[0];
$PASSWORD = $VARS[1];
$NAME = $VARS[2];

print "Creating user $USERNAME…$PASSWORD…$NAME…TEST
";

system("/home/vpopmail/bin/vadduser -c ‘$NAME’ -q 10000000 $USERNAME $PASSWORD");

print "Added mail account for $USERNAME
";

}

close(in) || die “cannot close file $filename: $!”;
--------------------------------------------------------------cut

The export script

Here is the script to export the mail accounts. This should work on any vpopmail install. Hope this comes in handy for someone else.

----------------------------------------------------------------------------cut---------------

#!/usr/bin/perl
open VDOM, “/home/vpopmail/bin/vdominfo -d |” or die (“failed to open pipe”);
open(FD,">emaillist") or die("Couldn’t open emaillist
") ;
while (my $line = <VDOM>) {
#process line
#print "$line
";
@VARS = split(///, $line);
$DOMAIN = $VARS[4];
$DOMAIN =~s/^\s+//; # replace leading spaces with nothing
$DOMAIN =~s/\s+$//; #replace trailing spaces with nothing
chomp($DOMAIN);
if ( $DOMAIN eq “” )
{

}
else
{

#print "$DOMAIN
";

my @VUSER = /home/vpopmail/bin/vuserinfo -ncCD $DOMAIN;
my $a = 1;
foreach $user (@VUSER) {
#print “$user
“;
chomp($user);
if ( $user eq “” ){
}
else
{
if ($a eq 1){
$email = $user.”@”.$DOMAIN;
}
if ($a eq 2){
$pass = $user;
}
if ($a eq 3){
$full = $user;
}
$a++;
if ($a eq 4){
$a = 1;
print FD "$email $pass $full
";
}
}
}

}
}
close(FD)

----------------------------------------------cut-------------------------------------------------

Hi.

Thanks for the script. It came in handy for me while doing a migration from Interworx to another cPanel.

BR
Allanpro

I copied this script to a file named mail-export.pl and ran “perl mail-export.pl” with no console output, nor can I determine any other output. Ideas?