1.下载
milter-limit-0.14.tar.gz
http://www.snertsoft.com/clients/downloads.php
libsnert-1.71.6.tar.gz
http://www.snertsoft.com/clients/downloads.php
sendmail.8.14.2.tar.gz
ftp://ftp.sendmail.org/pub/sendmail/sendmail.8.14.2.tar.gz
db-4.5.20.tar.gz
http://download.oracle.com/berkeley-db/db-4.5.20.tar.gz
2.安装
安装sendmail.8.14.2
- tar -zxf sendmail.8.14.2.tar.gz
- cd sendmail-8.14.2
- cd libmilter/
- ./Build -c
- ./Build install
- tar -zxf db-4.5.20.tar.gz
- cd db-4.5.20
- cd build_unix
- ../dist/configure
- make & make install
- tar -zxf milter-limit-0.14.tar.gz
- tar -zxf libsnert-1.71.6.tar.gz
- cd com/snert/src/lib
- ./configure & make && make install
- LibSnert/1.71.6
- Copyright 1996, 2009 by Anthony Howe. All rights reserved.
- Platform............: FreeBSD gcc
- Berkeley DB.........: 4.5 -ldb-4.5
- POSIX Threads.......: yes yes
- SQLite3.............: yes
- Sendmail libmilter..: yes
- Semaphore API.......: SYSTEMV_API
- Shared Memory API...: SYSTEMV_API
- CFLAGS..............: -I/usr/local/include/db45 -I/usr/home/feishu/limit/org/sqlite/include -D_THREAD_SAFE -pthread -D_REENTRANT -O2 -Wall -I${top_srcdir}/../../include
- LDFLAGS.............: -L/usr/local/lib/db45 -L/usr/home/feishu/limit/org/sqlite/lib -pthread -L${top_srcdir}/../../lib
- LIBS................:
- make build
- make install
- cd ../milter-limit
- ./configure --enable-run-user=postfix --enable-run-group=mail --enable-debug
- make build
- make install
- echo "smtpd_milters = unix:/var/run/milter/milter-limit.socket" >> /usr/local/etc/postfix/main.cf
- /usr/local/etc/rc.d/postfix restart
- /usr/local/etc/rc.d/milter-limit.sh restart
生成access.db的PHP脚本代码
- #!/usr/local/bin/php -q
- <?php
- $access = "/etc/mail/access";
- $fp = fopen($access,‘w+‘);
- $host ="localhost";
- $user = "FcAQQnc";
- $passwd = "VJuVdVFyv8PNauGr";
- $dbname = "tmail";
- $link = mysql_connect($host,$user,$passwd);
- mysql_select_db($dbname,$link);
- $query = "select * from tmail_users order by id desc";
- $rules = mysql_query($query,$link);
- while($rs = mysql_fetch_object($rules)){
- //限制账号一天发送量/d,可以限制一小时发送量/h
- $limit = "milter-limit-From:".$rs->email." ".$rs->sendnum."/1d"."\n";
- if(fwrite($fp,$limit)===FALSE){
- echo "不能写入文件。请检查文件权限。";
- }
- }
- system("/usr/sbin/makemap hash /etc/mail/access < /etc/mail/access");
- system("/usr/local/etc/rc.d/milter-limit.sh restart");
- ?>
- /libexec/ld-elf.so.1: Shared object "libdb-4.5.so" not found, required by "milter-limit"
- /libexec/ld-elf.so.1: Shared object "libdb-4.5.so" not found, required by "milter-limit
- ln -s /usr/local/BerkeleyDB.4.5/lib/libdb-4.5.so /usr/local/lib/libdb-4.5.so
- 上一篇:maildroprc调用spamassasin
- 下一篇:中国广播影视