[Mailman-Users] multiple/dynamic outbound smtp hosts?

Mark Sapiro msapiro at value.net
Mon Sep 25 05:09:46 CEST 2006


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 <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
Url: http://mail.python.org/pipermail/mailman-users/attachments/20060924/3a4d9288/attachment.txt 


More information about the Mailman-Users mailing list