码迷,mamicode.com
首页 > 其他好文 > 详细

Extmail 批量添加邮箱用户

时间:2018-06-21 17:15:35      阅读:992      评论:0      收藏:0      [点我收藏+]

标签:info   too   ase   email   查询   sub   .com   word   push   

Extmail  设置批量添加邮箱用户

需要修改  userctl.pl  文件

修改 userctl.pl 文件

cd /var/www/extsuite/extman/tools

编辑 userctl.pl   修改 sub adduer 模块 和 sub badd 模块;

 1、修改 sub adduer 模块;

注销 my $name 行;重新添加

sub adduser { ... my $email
= $_[0]; my $password = $_[1]; # 添加 my $name = my $name = $_[2]; my ($user,$domain) = split(/@/,$email); ... my $question = defined $opt{question} ? $opt{question} : ""; my $answer = defined $opt{answer} ? $opt{answer} : ""; # 注释 my $name = # my $name = defined $opt{name} ? $opt{name} : $user; my $mailhost = defined $opt{mailhost} ? $opt{mailhost} : ""; }

2、修改 sub badd 模块;

sub badd {
    if(!$opt{file}){
        push @exp, { prompt => "Please input a text file!" , status => 0};
        output ;
    }
    if( -e $opt{file} ){
        my @info;
        my $rv;
        open(BAF,"< $opt{file}")
            or die "Can‘t open $opt{file} !\n";
        while(<BAF>){
            chomp;
            @info = split(/ /, untaint($_));
       # 添加 $info[2] ; $rv
= adduser $info[0],$info[1],$info[2]; } close BAF; }else{ push @exp, { prompt => "File no exist!" , status => 0}; } output ; }

3、创建 批量邮箱账户模板文件;注意  txt 编码格式需要是 UTF-8 格式;

用户信息文件格式(Email地址、密码、邮箱配额、netdisk配额MB、名字)

# cat adduser.txt

user1@testextmail.com passwd 100 5 user1
user2@testextmail.com passwd 100 5 user2
user3@testextmail.com passwd 100 5 user3
user4@testextmail.com passwd 100 5 user4
user5@testextmail.com passwd 100 5 user5
user6@testextmail.com passwd 100 5 user6
user7@testextmail.com passwd 100 5 user7
user8@testextmail.com passwd 100 5 user8
user9@testextmail.com passwd 100 5 user9

4、添加账户:

/var/www/extsuite/extman/tools 当前目录下 

执行:

# perl ./userctl.pl --mod=badd --file=adduser.txt --setuid=1000 --setgid=1000

然后可以到 数据量的 mailbox 表进行查询;

 

Extmail 批量添加邮箱用户

标签:info   too   ase   email   查询   sub   .com   word   push   

原文地址:https://www.cnblogs.com/sharesdk/p/9209141.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!