[Mailman-Users] importing an archive in such a way as to populate the associated newsgroup.

2006-09-24 Thread Justin H Haynes
I set up a list recently, although actually a list by the same name has
existed for 8 years and has changed hands and software numerous times.
Mailman works very well for me and my list.  I have the mailnews
gateway set up bidirectionally, and it works great as well.  Several of
us either use mail or news and see each others posts threading properly.

The problem I am now trying to solve is how to get one 20,000 mailbox
file into the newsgroup.  This file has messages from different list
softwares, though I believe most were mailman.

I would consider this post off topic, were it not for the presence of
Queue/NewsRunner.py which seems to have a lot of the necessary
functionailty.

So my question is:

Suppose I were to temporarily turn off delivery to all the subscribers,
and then somehow run the entire archive through Mailman in such a way
that it were to deliver all the messages to the list.  Would such an
approach possibly be successful in getting all the messages into the
newsgroup?

Can mailman be invoked at the command line something like this?:

cat archive.mbx | some mailman executable


Thanks,

Justin


--
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=showamp;file=faq01.027.htp


Re: [Mailman-Users] importing an archive in such a way as to populatethe associated newsgroup.

2006-09-24 Thread Mark Sapiro
Justin H Haynes wrote:

Suppose I were to temporarily turn off delivery to all the subscribers,
and then somehow run the entire archive through Mailman in such a way
that it were to deliver all the messages to the list.  Would such an
approach possibly be successful in getting all the messages into the
newsgroup?


I don't think it is necessary to do that. As an experiment, you could
try extracting a single message from your archive.mbx (into say
msg.txt) and then do

bin/inject --listname=listname --queue=news msg.txt


Can mailman be invoked at the command line something like this?:

cat archive.mbx | some mailman executable


The problem here is that AFAIK there's nothing in Mailman you can use
directly to 'parse' the mbx file. There's a Mailbox class which is
essentially the standard Python mailbox.PortableUnixMailbox class
which has a next() method to get the messages one by one, but no
direct command (other than bin/arch) that processes mailbox files.

Assuming the experiment above works, you could probably create a simple
script in Python (or perl or even a shell script) that would extract
the messages one by one from the mailbox and pipe them to

bin/inject --listname=listname --queue=news

(bin/inject reads stdin if no filename arg is given).

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

--
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=showamp;file=faq01.027.htp


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

2006-09-24 Thread Mark Sapiro
Ken MacFerrin wrote:

I've been trying to modify SMTPDirect.py to do my bidding but my Python
skills are sorely lacking so any help would be greatly appreciated.  My
initial attempts have been to try to substitute the mm_cfg.SMTPHOST
variable with mlist.host_name.


This should work.


Obviously being able to implement a
solution directly in the mm_cfg file would be preferred but I'm not sure
that's possible..

original SMTPDirect code:
---
class Connection:
def __init__(self):
self.__conn = None

def __connect(self):
self.__conn = smtplib.SMTP()
self.__conn.connect(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)
self.__numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION


modified code:

class Connection:
def __init__(self):
self.__conn = None

def __connect(self):
self.__conn = smtplib.SMTP()
syslog('smtp-failure', 'host = %s, port = %s', mlist.host_name,
mm_cfg.SMTPPORT)


What do you get in smtp-failure from this?


x = self.__conn.connect(mlist.host_name, mm_cfg.SMTPPORT)


I don't think this is related to your problem, but instead of the
above, do the following:

if mlist:
host = mlist.host_name
else:
host = mm_cfg.SMTPHOST
x = self.__conn.connect(host, mm_cfg.SMTPPORT)


syslog('smtp-failure', 'connect returns: %s', x)


and what do you get from this?


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.



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.




---
Unfortunately, this fails with the following errors in the log:

Sep 23 20:51:28 2006 (3126) Uncaught runner exception: SMTP instance has
no attribute 'sock'
Sep 23 20:51:28 2006 (3126) Traceback (most recent call last):
  File /var/lib/mailman/Mailman/Queue/Runner.py, line 111, in _oneloop
self._onefile(msg, msgdata)
  File /var/lib/mailman/Mailman/Queue/Runner.py, line 167, in _onefile
keepqueued = self._dispose(mlist, msg, msgdata)
  File /var/lib/mailman/Mailman/Queue/OutgoingRunner.py, line 73, in
_dispose
self._func(mlist, msg, msgdata)
  File /var/lib/mailman/Mailman/Handlers/SMTPDirect.py, line 181, in
process
conn.quit()
  File /var/lib/mailman/Mailman/Handlers/SMTPDirect.py, line 102, in quit
self.__conn.quit()
  File smtplib.py, line 716, in quit
self.docmd(quit)
  File smtplib.py, line 377, in docmd
self.putcmd(cmd,args)
  File smtplib.py, line 333, in putcmd
self.send(str)
  File smtplib.py, line 318, in send
if self.sock:
AttributeError: SMTP instance has no attribute 'sock'


I don't see how this specific error can occur. Perhaps the additional
debug information will help.

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

--
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=showamp;file=faq01.027.htp


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

2006-09-24 Thread Mark Sapiro
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, Californiabetter 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
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=showamp;file=faq01.027.htp

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

2006-09-24 Thread Ken MacFerrin
Mark, thank you so much.  That did it.  Sorry I neglected to include the
list in my last reply.  I've just applied your patch and the headers are
now perfect on each domain's lists.  Many hours of frustration have now
come to an end and I can re-enable spf and domainkeys for these lists.

Sincerely,
Ken


 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.
 
 
 
 
 
 --- Mailman/Handlers/SMTPDirect.py2006-04-15 17:38:40.984375000 -0700
 +++ Mailman/Handlers/SMTPDirect.py2006-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
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=showamp;file=faq01.027.htp


[Mailman-Users] Can I send to mailing list but not ported newsgroup?

2006-09-24 Thread Mike Avery
Due to demand, I'm porting a few usenet newsgroups to mailing lists, and 
that is working pretty well.

However, every now and then I'd like to send administrivia to just the 
mailing list subscribers.  Is there an easy way to do that?  Or even a 
not-so-easy way?

Thanks,
Mike

-- 
...The irony is that Bill Gates claims to be making a stable operating
system and Linus Torvalds claims to be trying to take over the world...



--
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=showamp;file=faq01.027.htp


[Mailman-Users] Mailman just stopped

2006-09-24 Thread Carconni
First, thank you Mr. Sapiro for all the help you provide us.  I couldn't have 
gotten as far as I have with my mailmain program without you.

Out of desperation, I backed up the inbox (/private/var/mailman/qfiles/in) and 
dumped it and the lists just started working again.  I've started moving mail 
back little by little and everything seems to be okay now.

I'm still not sure what happened.  Aside from the logs I've already posted, 
there was nothing else to indicate what went wrong.  I will however look into 
rebuilding my mailman install if you believe that the installation should 
recoginize gb2312.

Thanks again and until the next calamity,

Constance

Carconni wrote

Mailman has been working beautifully for awhile now but yesterday it just 
stopped.  I wound up repairing all of the databases but it happened again 
today.  I'm getting the following error:

Sep 21 06:11:17 2006 (15075) Uncaught runner exception: unknown encoding: gb2312
Sep 21 06:11:17 2006 (15075) Traceback (most recent call last):
 File /usr/share/mailman/Mailman/Queue/Runner.py, line 111, in _oneloop
   self._onefile(msg, msgdata)
 File /usr/share/mailman/Mailman/Queue/Runner.py, line 167, in _onefile
   keepqueued = self._dispose(mlist, msg, msgdata)
 File /usr/share/mailman/Mailman/Queue/IncomingRunner.py, line 130, in 
_dispose
   more = self._dopipeline(mlist, msg, msgdata, pipeline)
 File /usr/share/mailman/Mailman/Queue/IncomingRunner.py, line 153, in 
_dopipeline
   sys.modules[modname].process(mlist, msg, msgdata)
 File /usr/share/mailman/Mailman/Handlers/CookHeaders.py, line 74, in process
   prefix_subject(mlist, msg, msgdata)
 File /usr/share/mailman/Mailman/Handlers/CookHeaders.py, line 262, in 
prefix_subject
   h.append(s, c)
 File 
/BinaryCache/mailman/mailman-117.root~35/usr/share/mailman/pythonlib/email/Header.py,
 line 285, in append
LookupError: unknown encoding: gb2312


Sep 21 06:11:17 2006 (15075) SHUNTING: 
1158844276.9904189+1e2464070413bcc3355b914153a142061eb60c6f


Does anyone know what might be causing this and why it would happen suddenly 
like this.


There are several things going on here. A message (most likely spam) is
being posted to your list and accepted for delivery. This message has
it's Subject: header encoded in the 'gb2312' (chinese) character set.

Mailman is trying to decode the Subject: so it can add the
subject_prefix and your Mailman/Python installation does not
support/recognize the 'gb2312' character set.

The above error occurs and the message is moved to Mailman's shunt
queue where it will stay untouched until you manually remove it or
queue it for reprocessing using bin/unshunt.

You can use bin/show_qfiles or bin/dumpdb to look at the entries in
qfiles/shunt and then just remove those you don't want.

You can also adjust your list settings to be not so generous in what
you accept.

There is something wrong with your Mailman installation as it should
recognize 'gb2312'.

This specific error should not stop Mailman. It just shunts the message
and that should be the end of it.

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



--
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=showamp;file=faq01.027.htp