全部博文(1144)
分类: LINUX
2006-05-19 09:16:06
由于直邮系统效率问题现在需要禁止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;
编译安装即可。