postfix 在线申请邮箱
小弟现在想做POSTFIX的在线申请, 得到用户名插入数据库倒是简单,但是产生有什么办法产生用户的系统邮箱文件呢?PHP不能调用 cyradm 中的命令/**********************************************/
cyradm --user cyrus localhost
IMAP Password:
jyli.com> sq user/jyli STORAGE 10485760
/**********************************************/
请各位大侠指教. [quote]【[b]在 lijianyu110 发表的大作中提到:[/b]】
:小弟现在想做POSTFIX的在线申请, 得到用户名插入数据库倒是简单,但是产生有什么办法产生用户的系统邮箱文件呢?PHP不能调用 cyradm 中的命令
:
:/**********************************************/
:cyradm --user cyrus localhost
[/quote]
系统用户?这个有点难度咯。要root权限哦。。。好象sudo可能可以实现,但。。。。
不要用unix account啦。。危险危险。 [quote]【[b]在 hzqbbc 发表的大作中提到:[/b]】
:
:
:系统用户?这个有点难度咯。要root权限哦。。。好象sudo可能可以实现,但。。。。
:不要用unix account啦。。危险危险。
[/quote]
听说用这个
"perl -MCyrus::IMAP::Shell -e shell -- --user cyrus localhost " 等命令
就可以调用cyradm的相关命令来管理油箱,请问有没有这方面的资料。 [quote]【[b]在 lijianyu110 发表的大作中提到:[/b]】
:
:听说用这个
: "perl -MCyrus::IMAP::Shell -e shell -- --user cyrus localhost " 等命令
:就可以调用cyradm的相关命令来管理油箱,请问有没有这方面的资料。
[/quote]
search.cpan.org [quote]【[b]在 hzqbbc 发表的大作中提到:[/b]】
:
:
:search.cpan.org
[/quote]
总算找到一偏文章。解决这个在线申请问题
http://tomster.org/geek/freebsdcookbook/ar01s03.html #!/usr/bin/perl -w
#
# This will create a new mailbox and set a quota on the new user. Just be
# sure that you installed the Cyrus::IMAP perl module. If you did
# 'make all && make install' or installed Cyrus using the FreeBSD ports you
# don't have to do anything at all.
#
# Change the params below to match your mailserver settins, and
# your good to go!
#
# Author: amram@manhattanprojects.com
#
# modified by Tom Lazar tom@tomster.org on 2003-08-26 to use
# a tab separated user - passwd inputfile instead of the standardpassword
use Cyrus::IMAP::Admin;
#
# CONFIGURATION PARAMS
#
my $cyrus_server = "localhost";
my $cyrus_user = "cyrus";
my $cyrus_pass = "CYRUSPASSWORD";
# 100 Megs
my $quota_size = "1000000";
my $mechanism = "login";
#
# EOC
#
if (!$ARGV[0]) {
die "Usage: $0 [user to add] passwd
";
} else {
$newuser = "$ARGV[0]";
$newpasswd = "$ARGV[1]";
}
sub createMailbox {
my ($user, $subfolder) = @_;
my $cyrus = Cyrus::IMAP::Admin->new($cyrus_server);
$cyrus->authenticate($mechanism,'imap','',$cyrus_user,'0','10000',$cyrus_pass);
if ($subfolder eq "INBOX") {
$mailbox = "user.". $user;
} else {
$mailbox = "user.". $user .".". $subfolder;
}
$cyrus->create($mailbox);
if ($cyrus->error) {
print STDERR "Error: ", $mailbox," ", $cyrus->error, "
";
} else {
print "Created Mailbox: $mailbox
";
}
}
sub setQuota {
my ($user) = @_;
my $cyrus = Cyrus::IMAP::Admin->new($cyrus_server);
$cyrus->authenticate($mechanism,'imap','',$cyrus_user,'0','10000',$cyrus_pass);
$mailbox = "user.". $user;
$cyrus->setquota($mailbox,"STORAGE",$quota_size);
if ($cyrus->error) {
print STDERR "Error: ", $mailbox," ", $cyrus->error, "
";
} else {
print "Setting Quota: $mailbox at $quota_size
";
}
}
print "Adding User: ", $newuser, "
";
createMailbox($newuser,'INBOX');
createMailbox($newuser,'Sent');
createMailbox($newuser,'Trash');
createMailbox($newuser,'Drafts');
createMailbox($newuser,'Junk');
setQuota($newuser);
# This portion below will set a password for the user you wanted to
# add.
system "echo ". $newpasswd ." > .saslpass.tmp";
system "saslpasswd2 -p $newuser < .saslpass.tmp";
print "Generated Password: Completed
";
unlink(".saslpass.tmp");
[quote]【[b]在 lijianyu110 发表的大作中提到:[/b]】
:#!/usr/bin/perl -w
:#
:# This will create a new mailbox and set a quota on the new user. Just be
:# sure that you installed the Cyrus::IMAP perl module. If you did
[/quote]
哦。干得好!加精华!:) 今天一人在办公室值班,看见这个网站。
http://www.1931-9-18.org/main/default.asp
看了这个flash
http://www.lizi.cc/mambo/index.php?option=com_docman&task=docclick&Itemid=62&bid=49&limitstart=0&limit=11
忍不住热泪夺眼而出。 иノ�F这个
http://email.uoa.gr/projects/cyrus/autocreate/index.html
页:
[1]