changeset 3667:35811df7c783

fix error during mailgw bouncing message [SF#1413501]
author Richard Jones <richard@users.sourceforge.net>
date Fri, 11 Aug 2006 01:41:25 +0000
parents 8304a1c1cc98
children a15c15510e99
files CHANGES.txt roundup/mailer.py roundup/mailgw.py
diffstat 3 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Fri Aug 11 01:33:59 2006 +0000
+++ b/CHANGES.txt	Fri Aug 11 01:41:25 2006 +0000
@@ -27,6 +27,7 @@
 - include roundup-server.ini.example (sf bug 1493859)
 - dumb bug in cgi templating utils (sf bug 1490176)
 - handle unicode in query names (sf bug 1495702)
+- fix error during mailgw bouncing message (sf bug 1413501)
 
 
 2006-04-27 1.1.2
--- a/roundup/mailer.py	Fri Aug 11 01:33:59 2006 +0000
+++ b/roundup/mailer.py	Fri Aug 11 01:41:25 2006 +0000
@@ -1,7 +1,7 @@
 """Sending Roundup-specific mail over SMTP.
 """
 __docformat__ = 'restructuredtext'
-# $Id: mailer.py,v 1.17 2006-02-21 05:48:23 a1s Exp $
+# $Id: mailer.py,v 1.18 2006-08-11 01:41:25 richard Exp $
 
 import time, quopri, os, socket, smtplib, re, sys, traceback
 
@@ -141,7 +141,14 @@
 
         writer.lastpart()
 
-        self.smtp_send(to, message)
+        try:
+            self.smtp_send(to, message)
+        except MessageSendError:
+            # squash mail sending errors when bouncing mail
+            # TODO this *could* be better, as we could notify admin of the
+            # problem (even though the vast majority of bounce errors are
+            # because of spam)
+            pass
 
     def exception_message(self):
         '''Send a message to the admins with information about the latest
--- a/roundup/mailgw.py	Fri Aug 11 01:33:59 2006 +0000
+++ b/roundup/mailgw.py	Fri Aug 11 01:41:25 2006 +0000
@@ -72,7 +72,7 @@
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception.
 
-$Id: mailgw.py,v 1.176 2006-08-03 00:50:06 richard Exp $
+$Id: mailgw.py,v 1.177 2006-08-11 01:41:25 richard Exp $
 """
 __docformat__ = 'restructuredtext'
 
@@ -535,19 +535,7 @@
             # just inform the user that he is not authorized
             m = ['']
             m.append(str(value))
-            try:
-                self.mailer.bounce_message(message, [sendto[0][1]], m)
-            except MessageSendError, error:
-                # if the only reason the bounce failed is because of
-                # invalid addresses to bounce the message back to, then
-                # just discard the message - it's just not worth bothering
-                # with (most likely spam / otherwise forged)
-                invalid = True
-                for address, (code, reason) in error.keys():
-                    if code != 550:
-                        invalid = False
-                if not invalid:
-                    raise
+            self.mailer.bounce_message(message, [sendto[0][1]], m)
         except IgnoreMessage:
             # do not take any action
             # this exception is thrown when email should be ignored

Roundup Issue Tracker: http://roundup-tracker.org/