Extmail 批量添加邮箱用户

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、执行 perl 批量添加账户:

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

执行:

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

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

 

转载于:https://www.cnblogs.com/sharesdk/p/9209141.html

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值