D G Teed wrote:
>
>Oh dear, that could be difficult to "prove" to Postfix peoples.
>Is there a way to get more verbose logging of what mailman
>is delivering other than what the mail server reports?
>That way I could compare the two and see
>which is dropping the ball.


Yes, and no.

Go to
<http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq04.073.htp>
and see the part at the end about adding

        self.__conn.set_debuglevel(1)

to the code in Mailman/Handlers/SMTPDirect.py. This addition (and
restarting Mailman) will log the entire SMTP transaction between
Mailman and Postfix.

BUT, in your case (RedHat with Mailman 2.1.5, you probably have Python
2.3.3 (or some 2.3.x) version. Prior to Python 2.4, this debug output
was written to stdout rather than stderr and that will cause other
problems, so if you are going to do this you need to first apply the
attached patch to your python Lib/smtplib.

-- 
Mark Sapiro <[EMAIL PROTECTED]>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

--- Python/Lib/smtplib.py       2002-10-06 19:55:08.000000000 -0700
+++ Python24/Lib/smtplib.py     2004-07-27 16:37:52.000000000 -0700
@@ -47,6 +47,7 @@
 import base64
 import hmac
 from email.base64MIME import encode as encode_base64
+from sys import stderr
 
 __all__ = ["SMTPException","SMTPServerDisconnected","SMTPResponseException",
            "SMTPSenderRefused","SMTPRecipientsRefused","SMTPDataError",
@@ -282,17 +283,17 @@
                 except ValueError:
                     raise socket.error, "nonnumeric port"
         if not port: port = SMTP_PORT
-        if self.debuglevel > 0: print 'connect:', (host, port)
+        if self.debuglevel > 0: print>>stderr, 'connect:', (host, port)
         msg = "getaddrinfo returns an empty list"
         self.sock = None
         for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
             af, socktype, proto, canonname, sa = res
             try:
                 self.sock = socket.socket(af, socktype, proto)
-                if self.debuglevel > 0: print 'connect:', (host, port)
+                if self.debuglevel > 0: print>>stderr, 'connect:', (host, port)
                 self.sock.connect(sa)
             except socket.error, msg:
-                if self.debuglevel > 0: print 'connect fail:', (host, port)
+                if self.debuglevel > 0: print>>stderr, 'connect fail:', (host, 
port)
                 if self.sock:
                     self.sock.close()
                 self.sock = None
@@ -301,12 +302,12 @@
         if not self.sock:
             raise socket.error, msg
         (code, msg) = self.getreply()
-        if self.debuglevel > 0: print "connect:", msg
+        if self.debuglevel > 0: print>>stderr, "connect:", msg
         return (code, msg)
 
     def send(self, str):
         """Send `str' to the server."""
-        if self.debuglevel > 0: print 'send:', `str`
+        if self.debuglevel > 0: print>>stderr, 'send:', repr(str)
         if self.sock:
             try:
                 self.sock.sendall(str)
@@ -345,7 +346,7 @@
             if line == '':
                 self.close()
                 raise SMTPServerDisconnected("Connection unexpectedly closed")
-            if self.debuglevel > 0: print 'reply:', `line`
+            if self.debuglevel > 0: print>>stderr, 'reply:', repr(line)
             resp.append(line[4:].strip())
             code=line[:3]
             # Check that the error code is syntactically correct.
@@ -361,7 +362,7 @@
 
         errmsg = "\n".join(resp)
         if self.debuglevel > 0:
-            print 'reply: retcode (%s); Msg: %s' % (errcode,errmsg)
+            print>>stderr, 'reply: retcode (%s); Msg: %s' % (errcode,errmsg)
         return errcode, errmsg
 
     def docmd(self, cmd, args=""):
@@ -474,7 +475,7 @@
         """
         self.putcmd("data")
         (code,repl)=self.getreply()
-        if self.debuglevel >0 : print "data:", (code,repl)
+        if self.debuglevel >0 : print>>stderr, "data:", (code,repl)
         if code != 354:
             raise SMTPDataError(code,repl)
         else:
@@ -484,7 +485,7 @@
             q = q + "." + CRLF
             self.send(q)
             (code,msg)=self.getreply()
-            if self.debuglevel >0 : print "data:", (code,msg)
+            if self.debuglevel >0 : print>>stderr, "data:", (code,msg)
             return (code,msg)
 
     def verify(self, address):
@@ -666,7 +667,7 @@
             # Hmmm? what's this? -ddm
             # self.esmtp_features['7bit']=""
             if self.has_extn('size'):
-                esmtp_opts.append("size=" + `len(msg)`)
+                esmtp_opts.append("size=%d" % len(msg))
             for option in mail_options:
                 esmtp_opts.append(option)
 
@@ -727,7 +728,7 @@
         if not line:
             break
         msg = msg + line
-    print "Message length is " + `len(msg)`
+    print "Message length is %d" % len(msg)
 
     server = SMTP('localhost')
     server.set_debuglevel(1)
------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&amp;file=faq01.027.htp

Reply via email to