Qmail Toaster Help / Perl Help

Gilbert T. Gutierrez, Jr. plug at phxinternet.net
Fri Dec 15 11:21:35 MST 2006


My Script (the cvs file is in the following format
"Username,Password,Domain," with that extra comma that way I loose the end
of line character)...

Now all I need to do is import mail.

Gilbert

#!/usr/bin/perl
# This is a test script to take users with
# encrypted passwords from IMAIL to QMAIL TOASTER

use Crypt::Imail;

# open the csv file
open(CSV,"passwords.csv") or die "Cannot open passwords.csv!\n";

$im = Crypt::Imail->new();

my $string = <CSV>;

while (<CSV>) {
  # create an array
  my @list = split (/,/);
  # decrypt password
  my $password = $im->decrypt(lc"$list[0]",$list[1]);
  # print to shell username and password
  print "The Password is for $list[0]... $password.\n";
  # add the user to the toaster
  system ("/home/vpopmail/bin/vadduser", "$list[0]\@$list[2]", "$password");
}
# close the csv file
close(CSV);

---
[ This E-mail was scanned for viruses by Phoenix Internet ]
[ Phoenix Internet http://www.phoenixinternet.net ]



More information about the PLUG-discuss mailing list