Hi All,

I've just recently setup TMDA and wanted to say thanks for everybody's efforts 
in creating such a useful program.  Great job.

I have noticed one small problem however.  When I enabled the 
PENDING_DELETE_APPEND option in my config file, it seems that only about 1 
out of 50 messages have a valid 'x-primary-address' or 'return-path' headers.  
As a result, my list is being filled with mostly blank lines when I use that 
feature.

I made a small change to Pending.py that seems to correct this problem for me.  
Basically, if the 'return-path' field is empty in the message, I retrieve the 
'from' field and use it instead.

I wanted to send this change along for possible inclusion in future versions 
of TMDA.

Regards,
Randy Pearson

P.S.  I'm not very familiar with coding in Python, so any mistakes are most 
likely all mine.

--- tmda-0.92.orig/TMDA/Pending.py	2003-12-10 01:36:55.000000000 -0600
+++ tmda-0.92/TMDA/Pending.py	2003-12-19 09:03:39.000000000 -0600
@@ -212,7 +212,10 @@
                     pass
                 else:
                     rp = parseaddr(msgobj.get('return-path'))[1]
-                    Util.append_to_file(rp, Defaults.PENDING_DELETE_APPEND)
+                    if len(rp) == 0:
+                        rp = parseaddr(msgobj.get('from'))[1]
+                    if len(rp) > 0:
+                        Util.append_to_file(rp, Defaults.PENDING_DELETE_APPEND)
             try:
                 os.unlink(msgfile)
             except OSError:
@@ -429,6 +432,8 @@
         if self.recipient is None:
             self.recipient = self.msgobj.get('x-tmda-recipient')
         self.return_path = parseaddr(self.msgobj.get('return-path'))[1]
+        if len(self.return_path) == 0:
+            self.return_path = parseaddr(self.msgobj.get('from'))[1]
         self.x_primary_address = parseaddr(self.msgobj.get('x-primary-address'))[1]
         self.append_address = Util.confirm_append_address(
             self.x_primary_address, self.return_path)
_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to