Skip to content

Commit a07c999

Browse files
author
Richard Jones
committed
fix error during mailgw bouncing message [SF#1413501]
1 parent 51daacb commit a07c999

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Fixed:
2727
- include roundup-server.ini.example (sf bug 1493859)
2828
- dumb bug in cgi templating utils (sf bug 1490176)
2929
- handle unicode in query names (sf bug 1495702)
30+
- fix error during mailgw bouncing message (sf bug 1413501)
3031

3132

3233
2006-04-27 1.1.2

roundup/mailer.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Sending Roundup-specific mail over SMTP.
22
"""
33
__docformat__ = 'restructuredtext'
4-
# $Id: mailer.py,v 1.17 2006-02-21 05:48:23 a1s Exp $
4+
# $Id: mailer.py,v 1.18 2006-08-11 01:41:25 richard Exp $
55

66
import time, quopri, os, socket, smtplib, re, sys, traceback
77

@@ -141,7 +141,14 @@ def bounce_message(self, bounced_message, to, error,
141141

142142
writer.lastpart()
143143

144-
self.smtp_send(to, message)
144+
try:
145+
self.smtp_send(to, message)
146+
except MessageSendError:
147+
# squash mail sending errors when bouncing mail
148+
# TODO this *could* be better, as we could notify admin of the
149+
# problem (even though the vast majority of bounce errors are
150+
# because of spam)
151+
pass
145152

146153
def exception_message(self):
147154
'''Send a message to the admins with information about the latest

roundup/mailgw.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.176 2006-08-03 00:50:06 richard Exp $
75+
$Id: mailgw.py,v 1.177 2006-08-11 01:41:25 richard Exp $
7676
"""
7777
__docformat__ = 'restructuredtext'
7878

@@ -535,19 +535,7 @@ def handle_Message(self, message):
535535
# just inform the user that he is not authorized
536536
m = ['']
537537
m.append(str(value))
538-
try:
539-
self.mailer.bounce_message(message, [sendto[0][1]], m)
540-
except MessageSendError, error:
541-
# if the only reason the bounce failed is because of
542-
# invalid addresses to bounce the message back to, then
543-
# just discard the message - it's just not worth bothering
544-
# with (most likely spam / otherwise forged)
545-
invalid = True
546-
for address, (code, reason) in error.keys():
547-
if code != 550:
548-
invalid = False
549-
if not invalid:
550-
raise
538+
self.mailer.bounce_message(message, [sendto[0][1]], m)
551539
except IgnoreMessage:
552540
# do not take any action
553541
# this exception is thrown when email should be ignored

0 commit comments

Comments
 (0)