Ken MacFerrin wrote:
>> 
>> What do you get in smtp-failure from this?
>
>Currently I don't get anything.. I only get the errors I listed in my
>last email in /var/log/mailman/error.  The /var/log/mailman/smtp-failure
>log remains empty.


Yes, I overlooked the blindingly obvious - see below.


>>>        self.__conn.local_hostname = 'localhost'
>> 
>> 
>> I don't know why you want to do this. Also, if you need to do it, it is
>> better to give local_hostname='localhost' as an argument to the
>> smtplib.SMTP() constructor.
>
>I was doing this to hide the primary hostname for the machine from
>showing up in the Received header for mail being passed from Mailman to
>the outbound virtual domain smtp server since I don't want the headers
>to list the machine's fqdn in messages for the virtual domains.  Before
>doing this I was getting:
>Received: from host.domain.name by smtp.virtualdomain.com (Postfix)...
>
>Doing this I now get:
>Received: from localhost by smtp.virtualdomain.com (Postfix)...


OK. I understand.


>>>        self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION
>>>        self.__set_debuglevel = 1
>> 
>> 
>> This does nothing useful. what you want is
>> 
>>         self.__conn.set_debuglevel(1)
>> 
>> and I would put it earlier - right after "self.__conn =
>> smtplib.SMTP()". Debug messages should go to Mailman's error log.
>
>I tried as you mentioned here but kept getting the following error when
>doing so:
>Sep 24 18:42:45 2006 (23668) Uncaught runner exception: Connection
>instance has no attribute '_Connection__set_debuglevel'


I don't understand the above error. It works for me.


>Here's the code I'm using now:
>
>    def __connect(self):
>        self.__conn = smtplib.SMTP()
>        self.__set_debuglevel = 1
>        if mlist:
>            host = mlist.host_name


The blindingly obvious - mlist is undefined.


>        else:
>            host = mm_cfg.SMTPHOST
>        syslog('smtp-failure', 'host = %s, port = %s', host,
>mm_cfg.SMTPPORT)
>        x = self.__conn.connect(host, mm_cfg.SMTPPORT)
>        syslog('smtp-failure', 'connect returns: %s', x)
>        self.__conn.local_hostname = 'localhost'
>        self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION



The attached patch works. This is a 2.1.9 base, you may have to adjust
the line numbers and of course remove the debugging stuff.

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

--- Mailman/Handlers/SMTPDirect.py      2006-04-15 17:38:40.984375000 -0700
+++ Mailman/Handlers/SMTPDirect.py      2006-09-24 19:45:40.671875000 -0700
@@ -56,12 +56,21 @@
 
 # Manage a connection to the SMTP server
 class Connection:
-    def __init__(self):
+    def __init__(self, mlist):
         self.__conn = None
+        self.mlist = mlist
 
     def __connect(self):
         self.__conn = smtplib.SMTP()
-        self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)
+        self.__conn.set_debuglevel(1)
+        if self.mlist:
+            host = self.mlist.host_name
+        else:
+            host = mm_cfg.SMTPHOST
+        syslog('smtp-failure', 'host = %s, port = %s', host, mm_cfg.SMTPPORT)
+        x = self.__conn.connect(host, mm_cfg.SMTPPORT)
+        syslog('smtp-failure', 'connect returns: %s', x)
+        self.__conn.local_hostname = 'localhost'
         self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION
 
     def sendmail(self, envsender, recips, msgtext):
@@ -149,7 +158,7 @@
     # This means at worst, the last chunk for which delivery was attempted
     # could get duplicates but not every one, and no recips should miss the
     # message.
-    conn = Connection()
+    conn = Connection(mlist)
     try:
         msgdata['undelivered'] = chunks
         while chunks:
------------------------------------------------------
Mailman-Users mailing list
[email protected]
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