- 论坛徽章:
- 0
|
每週主題二: 更改 ISP 對 DNS 的影響(間接影響 MAIL/WEB ...)
[quote]原帖由 "hanyoo"]小弟以前曾供职两家公司,都遇到此类事,其中所作步骤与网中人所说并无多大差异,只不过其中一次是把在香港ilink的邮件服务停用(sendmail), 移至上海这边邮件服务器(qmail).两种邮件存储格式转换没解决,后来就让同事们?.........[/quote 发表:
sendmail转qmail是可以的,网上有这样的perl程序提供。
以前做过一次。我把代码贴出来,希望对大家有用。
- #! /usr/bin/perl
- # put into the public domain by Russell Nelson <nelson@qmail.org>;
- # NO GUARANTEE AT ALL; support is available for a fee from the author.
- #
- # Creates maildirs for everyone in /etc/passwd who receives mail.
- # Copies all their mail in /var/spool/mail into their maildir.
- # Assumes that nothing is trying to modify the mailboxes in /var/spool/mail
- # This assumption could be removed by locking the mailboxes and deleting
- # the mail after moving it.
- # version 0.00 - first release to the public.
- open(FILE,"./cvt_list.txt") || die "can't open the list file\n";
- while($name=<FILE>;) {
- $uid = 509;
- $gid = 504;
- chop($name);
- print "$name\n";
- $userhomedir = "/home/vpopmail/domains/test.com/$name";
- -d $userhomedir || mkdir $userhomedir,0700 || die "fatal: user home dir can't be created. \n";
- chown ($uid,$gid,$userhomedir);
- $spoolname = "/home/vpopmail/domains/test.com/$name/Maildir";
- -d $userhomedir || mkdir $userhomedir,0700 || die "fatal: user home dir can't be created. \n";
- chown ($uid,$gid,$userhomedir);
- -d $spoolname || mkdir $spoolname,0700 || die "fatal: mailbox doesn't exist and can't be created.\n";
- chown ($uid,$gid,$spoolname);
- chdir($spoolname) || die("fatal: unable to chdir to $spoolname.\n");
- -d "tmp" || mkdir("tmp",0700) || die("fatal: unable to make tmp/ subdir\n");
- -d "new" || mkdir("new",0700) || die("fatal: unable to make new/ subdir\n");
- -d "cur" || mkdir("cur",0700) || die("fatal: unable to make cur/ subdir\n");
- chown ($uid,$gid,"tmp","new","cur");
- open(SPOOL, "</root/$name") || next;
- $i = time;
- while(<SPOOL>;) {
- if (/^From /) {
- $fn = sprintf("new/%d.$$.mbox", $i);
- open(OUT, ">;$fn") || die("fatal: unable to create new message");;
- chown ($uid,$gid,$fn);
- $i++;
- next;
- }
- s/^>;From /From /;
- print OUT || die("fatal: unable to write to new message");
- }
- close(SPOOL);
- close(OUT);
- }
复制代码 |
|