QmailtoasterMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Migrating from IMail

From Qmailtoaster

Created/edited by --Gilbert 00:19, 19 Dec 2006 (EST)

These instructions show users how to migrate IMail by IPSwitch users with encrypted passwords to the QMAIL-TOASTER. This instruction was designed for use with IMail by IPSwitch version 7.07 but should work fine with other versions of IMail.

Alternately, there is a similar and complete Perl script for assisting in the migration from IMail to qmail.

Requirements on QMAIL-TOASTER:

Perl Module Crypt::Imail You can retrieve and install the module at your shell by entering:

# perl -e 'use CPAN; install Crypt::Imail;'

Gathering information from IMail Server:

The first thing you need to do is export the registry key "My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Ipswitch\IMail\Domains". You can do this by typing "regedit" at the Windows run prompt, navigate to the key, select "Registry | Export Registry File". Windows exports the registry in Unicode format, so you need to change the file to ANSI format. Open the file that you just created in notepad, choose "File | Save As", change the option under encoding from "Unicode" to "ANSI", and finally press the Save button. Move the file to your new QMAIL-TOASTER.

Creating accounts on QMAIL-TOASTER:

Make sure you have installed the module Crypt::Imail and have copied over the Imail registry to the QMAIL-TOASTER server. The perl script below references the registry file as imail.txt so please rename your file to imail.txt. The script does not create domains on the QMAIL-TOASTER server, so you will need to add the domains to the QMAIL-TOASTER independently before you run the script. Also, data will be pushed to standard out (your screen) as it is running. This is not necessary and you may comment out the lines that are in the script that print to standard out.



#!/usr/bin/perl
# This script takes a ASCI copy of the IMAIL domain registry
# and adds the usernames and passwords into the Qmail toaster

#You need the Imail module found in CPAN to run this script
use Crypt::Imail;

# OPEN the Registry File
open(REGFILE,"imail.txt") || die "Cannot open imail.txt\n";

# Define a variable of type Imail
my $im = Crypt::Imail->new();
# Define an array myreg and put exported registry into the array
my @myreg = <REGFILE>;
# Define an array to store usernames and passwords
my @names;
# Define an array to store unencrypted usernames and passwords
my @unencrypted;

# Transverse the exported registry
foreach $listitem ( @myreg ) {
   # Isolate any lines with the word MailAddr or Password
   if (grep(/MailAddr/, $listitem) || grep(/Password/, $listitem)) {
      if (grep(/MailAddr/, $listitem)) { # Isolate Email address
         # use split to isolate tag from value
         @list = split (/=/, $listitem);
         $username = $list[1];
         # remove the line feed
         $username =~ s/\s+$//;
         # remove trailing quote
         $username =~ s/\"$//;
         # remove the leading quote
         $username =~ s/^\"//;
         # replace the @ sign with a comma
         $username =~ s/\@/,/;
      } else { # Isolate Password and put value into array
         # use split to isolate tag from value
         @list = split (/=/, $listitem);
         # remove the line feed
         $list[1] =~ s/\s+$//;
         # remove trailing quote
         $list[1] =~ s/\"$//;
         # remove the leading quote
         $list[1] =~ s/^\"//;

         # put email address and password into a new array
         push(@names, "$username,$list[1]\n");
      }
   }
}

# print the newly created array
print @names;

# close the registry file
close (REGFILE);

foreach $listitem ( @names ) {
   # create an array
   @list = split (/,/, $listitem);
   # decrypt password, the username needs to be lower case
   $password = $im->decrypt(lc"$list[0]",$list[2]);
   # print to shell the username and password
   print "The Password is for $list[0]\@$list[1]... $password.\n";
   # Uncomment if you want to create a file with the unencrypted info

   push (@unencrypted, "$list[0]\@$list[1],$password\n");
   # add the user to the toaster
   system ("/home/vpopmail/bin/vadduser", "$list[0]\@$list[1]","$password");
}

# print the newly created array
print @unencrypted

Retrieved from "http://wiki.qmailtoaster.com/index.php/Migrating_from_IMail"

This page has been accessed 16,960 times. This page was last modified on 29 September 2010, at 23:14. Content is available under GNU Free Documentation License 1.2.


Find

Browse
Main page
Community portal
Current events
Recent changes
Random page
Help
Edit
View source
Editing help
This page
Discuss this page
New section
Printable version
Context
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list
Statistics
More...