|
postfix所谓监控的监控功能是利用sender_bcc,我测试了一下很容易做到。
修改main.cf
[iyunv@localhost etc]# vi ./postfix/main.cf
sender_bcc_maps = mysql:/etc/postfix/mail_watch.cf
recipient_bcc_maps = mysql:/etc/postfix/mail_watch.cf
再建个 mail_watch.cf
[iyunv@localhost postfix]# vi mail_watch.cf
user=lcx //数据库的用户名
password=123456 //数据库的密码
dbname=postfix //库名
table=mail_watch //表名
select_field=bcc //监控信箱
where_field=sender //被监控的信箱
hosts=localhost //服务器名
建表,再建一个lcx数据库用户,测试了下postfix的cf空密码无效
mysql> CREATE TABLE `mail_watch` (
`sender` varchar(100) NOT NULL,
`bcc` varchar(100) NOT NULL,
PRIMARY KEY (`sender`)
);
mysql> grant all on postfix.* to lcx@localhost identified by '123456';
mysql> desc mail_watch;
+--------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+---------+-------+
| sender | varchar(100) | NO | PRI | | |
| bcc | varchar(100) | NO | | | |
+--------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
lcx@vb.net.cn 为监控邮箱,123@vb.net.cn是被监控的信箱
mysql> INSERT INTO mail_watch(sender,bcc) VALUES ('123@vb.net.cn','lcx@vb.net.cn');
mysql> select * from mail_watch;
+---------------+---------------+
| sender | bcc |
+---------------+---------------+
| 123@vb.net.cn | lcx@vb.net.cn |
+---------------+---------------+
1 row in set (0.00 sec)
以上方法已经测试通过 |
|
|