Qmail
[Top] [All Lists]

rblsmtpd patch for additional info in SMTP reply

To: qmail@list.cr.yp.to
Subject: rblsmtpd patch for additional info in SMTP reply
From: "Robert Sander" <robert.sander@epigenomics.com>
Date: 4 Apr 2007 13:50:53 +0200
Delivered-to: sp-com-lists@consult.net
Delivered-to: gmail-qmail@securepoint.com
Delivered-to: sp.com.list@gmail.com
Delivered-to: mailing list qmail@list.cr.yp.to
Fnord: +++ath
Mailing-list: contact qmail-help@list.cr.yp.to; run by ezmlm
Msmail-priority: High
User-agent: Mutt/1.5.9i
Hi!

As ucspi-tcp has no mailing list of its own this goes to the qmail list.

I wrote a little patch to rblsmtpd to have an additional message in the
SMTP reply to be able to inform the sender of a blocked email about
alternatives etc.

It reads a string from the environment variable RBLMESSAGE and puts it
right after the SMTP error code and before the message from the DNSBL.

We are using it like this:

In /etc/tcp.smtp tcprules file for qmail-smtpd:

:allow,RBLMESSAGE="Please forward this message to <postmaster@epigenomics.com>: 
"

A sender that was rejected in error then sees the alternative address
and is able to forward his request to us.

diff -ruN ucspi-tcp-src/ucspi-tcp-0.88/rblsmtpd.c
ucspi-tcp-src-epi/ucspi-tcp-0.88/rblsmtpd.c
--- ucspi-tcp-src/ucspi-tcp-0.88/rblsmtpd.c     2000-03-18
16:18:42.000000000 +0100
+++ ucspi-tcp-src-epi/ucspi-tcp-0.88/rblsmtpd.c 2007-04-04
13:27:40.400780000 +0200
@@ -118,18 +118,26 @@
 void rblsmtpd(void)
 {
   int i;
+  char *x;

+  x = env_get("RBLMESSAGE");
+
   if (flagmustnotbounce || (decision == 2)) {
     if (!stralloc_copys(&message,"451 ")) nomem();
   }
   else
     if (!stralloc_copys(&message,"553 ")) nomem();

+  if (x && *x)
+    if (!stralloc_cats(&message, x))
+      nomem();
+
   if (text.len > 200) text.len = 200;
   if (!stralloc_cat(&message,&text)) nomem();
   for (i = 0;i < message.len;++i)
     if ((message.s[i] < 32) || (message.s[i] > 126))
       message.s[i] = '?';
+

   buffer_puts(buffer_2,"rblsmtpd: ");
   buffer_puts(buffer_2,ip_env);

Use at your own risk.

Greetings
-- 
Robert Sander                     Senior Manager Information Systems
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-0                            fax:+49-30-24345-555
http://www.epigenomics.com             robert.sander@epigenomics.com

<Prev in Thread] Current Thread [Next in Thread>
  • rblsmtpd patch for additional info in SMTP reply, Robert Sander <=