Hi,
  I want to write the following patch for qmail. At some small site,you can only 
filtrate the spam by the filter invoke from dotqmail, but our server will receive over 
100000 junk mails per day,qmail-send & qmail-local  take so much time to delivert 
these letters. Kill the spam in qmail-smtpd should be the best way.
  But the problem is how to write the function 'spamcheck(int spamflag)' ? 


In qmail-smtpd.c:

+  spam=0;
  received(&qqt,"SMTP",local,remoteip,remotehost,remoteinfo,fakehelo);
  blast(&hops);
+ spamcheck(&spam);   //The functin will read some control file,such as 
+control/badkeyword, if matched,then ...
  hops = (hops >= MAXHOPS);
  if (hops) qmail_fail(&qqt);
  qmail_from(&qqt,mailfrom.s);
  qmail_put(&qqt,rcptto.s,rcptto.len);

  qqx = qmail_close(&qqt);
  if (!*qqx) { acceptmessage(qp); return; }
  if (hops) { out("554 too many hops, this message is looping (#5.4.6)\r\n"); return; }
+ if (spam) { out("551 Spam shit! You are not welcome!\r\n"; return; );
  if (databytes) if (!bytestooverflow) { out("552 sorry, that message size excee...
  if (*qqx == 'D') out("554 "); else out("451 ");
  out(qqx + 1);
  out("\r\n");

then,it will do something like this:

220 mydomain.com ESMTP
helo iamspam
250 mydomain.com
mail from:<>
250 ok
rcpt to:<someone@>
250 ok
data
354 go ahead
From: [EMAIL PROTECTED]


win money from ....        <---'win money' is in control/badkeyword,so this letter 
should be refused.


.
551 Spam shit! You are not welcome!



Thanks very much!



            Hotdog
            [EMAIL PROTECTED]

Reply via email to