Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5376744
  • 博文数量: 1144
  • 博客积分: 11974
  • 博客等级: 上将
  • 技术积分: 12312
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-13 20:06
文章存档

2017年(2)

2016年(14)

2015年(10)

2014年(28)

2013年(23)

2012年(29)

2011年(53)

2010年(86)

2009年(83)

2008年(43)

2007年(153)

2006年(575)

2005年(45)

分类: LINUX

2006-05-19 09:16:06

禁止qmail系统退信

由于直邮系统效率问题现在需要禁止qmail对发不出的邮件发退信通知邮件,即关闭系统邮件通知功能。查了些资料发现这个方法可行:
参照Rusell Nelson得doublebounce-trim patch, 该patch会“discards doublebounces without queuing them”。该patch如下:

If you don't want doublebounces to hit your queue a second time
(because you have, say, ten million mailboxes and as much legitimate
email traffic and more spam), the following patch will immediately
discard bouncing bounces. Note that doublebounceto must start with a
blank line; that is, it must have one newline in it. A totally empty
file means "use the default of 'posthamster'".

This version was rewritten by Charles Cazabon from my original patch
to include a man page, turn the patch around in the right direction,
and emit its own message for the logfile.

Apply this patch as so:

cd /usr/local/src/qmail-1.03
patch

diff -urN qmail-1.03.orig/qmail-send.9 qmail-1.03.nodoublebounce/qmail-send.9
--- qmail-1.03.orig/qmail-send.9 Mon Jun 15 04:53:16 1998
+++ qmail-1.03.nodoublebounce/qmail-send.9 Tue Sep 9 12:59:04 2003
@@ -115,6 +115,10 @@
(If that bounces,
.B qmail-send
gives up.)
+As a special case, if the first line of
+.IR doublebounceto
+is blank (contains a single linefeed), qmail-send will not queue
+the double-bounce at all.
.TP 5
.I envnoathost
Presumed domain name for addresses without @ signs.
diff -urN qmail-1.03.orig/qmail-send.c qmail-1.03.nodoublebounce/qmail-send.c
--- qmail-1.03.orig/qmail-send.c Mon Jun 15 04:53:16 1998
+++ qmail-1.03.nodoublebounce/qmail-send.c Tue Sep 9 13:02:43 2003
@@ -683,6 +683,8 @@
}
if (str_equal(sender.s,"#@[]"))
log3("triple bounce: discarding ",fn2.s,"\n");
+ else if (!*sender.s && *doublebounceto.s == '@')
+ log3("double bounce: discarding ",fn2.s,"\n");
else
{
if (qmail_open(&qqt) == -1)

--9jxsPFA5p3P2qPhR--

如果不希望产生任何bounce消息, 直接在qmail-send.c中的injectbounce()函数开头返回1即可,在qmail-send.c的650行后添加一行:
return 1;

即修改如下内容:
int injectbounce(id)
unsigned long id;
{
struct qmail qqt;
struct stat st;
char *bouncesender;
char *bouncerecip;


int injectbounce(id)
unsigned long id;
{
return 1;
struct qmail qqt;
struct stat st;
char *bouncesender;
char *bouncerecip;

编译安装即可。

阅读(852) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~