1. 安装
cd /srv
tar zxvf postfixadmin-2.2.11.tar.gz
mv postfixadmin-2.2.11 /var/www/postfixadmin
2. 更改属主和属组
chown -R vmail:vmail /var/www/postfixadmin
3 配置(/var/www/postfixadmin目录下)
(1)修改相关的配置文件(红色为需要修改后的部分,蓝色为非必须更改的)。
vi config.inc.php
$CONF['configured'] = true;
$CONF['postfix_admin_url'] = '/postfixadmin';
$CONF['default_language'] = 'cn';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = ‘123456';
$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'NO';
$CONF['transport'] = 'YES';
$CONF['transport_options'] = array (
'virtual', // for virtual accounts
'local', // for system accounts
'relay' // for backup mx
'maildrop'
);
$CONF['transport_default'] = 'maildrop';
$CONF['aliases'] = '1000';
$CONF['mailboxes'] = '1000';
$CONF['maxquota'] = '1000';
$CONF['quota'] = 'YES';
$CONF['quota_multiplier'] = '1024000';
(2)添加创建邮箱的信息(蓝色为文件位置,红色为添加内容)
vi createmailbox.php
$tQuota = $CONF['maxquota'];(294行)
system("sudo /usr/sbin/maildirmake.sh $fDomain
".$_POST['fUsername']);
if ($fMail == "on")
(3) 添加删除邮箱的信息(蓝色为文件位置,红色为添加内容)
vi delete.php
$result =db_query ("SELECT * FROM mailbox WHERE
username='$fDelete' AND domain='$fDomain'");(123行)
$userarray=explode("@",$fDelete);
$user=$userarray[0];
$domain=$userarray[1];
system("sudo /usr/sbin/maildirdel.sh $domain $user");
(4) 创建脚本并赋予权限(内容见附件)
vi /usr/sbin/maildirmake.sh
vi /usr/sbin/maildirdel.sh
chmod 777 /usr/sbin/maildirmake.sh
chmod 777 /usr/sbin/maildirdel.sh
(5)添加虚拟主机信息
cd /etc/httpd/conf/sites-enabled/
vi postfixadmin.conf (内容见附件)
保存后重起apache服务(/etc/init.d/httpd restart),然后在别的机器的浏览器输入邮件服务器的url如:http://192.168.10.193/postfixadmin
( 6 ) 修改/etc/sudoers
[root@test ~]# chmod +w /etc/sudoers
[root@test ~]# vi + /etc/sudoers
vmail ALL = NOPASSWD: /usr/sbin/maildirmake.sh , /usr/sbin/maildirdel.sh(追加到文件末尾即可)
Defaults requiretty(注释掉)
[root@test ~]# chmod -w /etc/sudoers
(7)创建邮箱目录并且赋予权限
mkdir /var/mailbox
chown -R vmail:vmail /var/mailbox