summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Vagelpohl <jens@netz.ooo>2002-12-13 03:28:47 +0000
committerJens Vagelpohl <jens@netz.ooo>2002-12-13 03:28:47 +0000
commitfb8dad52a756894e9d45fe7d16591a67b22597ce (patch)
treeb764affc1fcb84aed30e8f36e091e013bf632344
parent7b638c786184da8c888f415b733b3db39e6d5269 (diff)
downloadJTracker-fb8dad52a756894e9d45fe7d16591a67b22597ce.zip
JTracker-fb8dad52a756894e9d45fe7d16591a67b22597ce.tar.gz
- incoming email error checking
- subject de-mimification (tracker issue 205)
-rw-r--r--CHANGES.txt19
-rw-r--r--Extensions/emailAccepter.py16
-rw-r--r--utils.py4
3 files changed, 23 insertions, 16 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 890de78..bd779dd 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,25 @@ CHANGES.txt for the JTracker
This file contains change information for the JTracker product.
+ 1.5
+
+ Features added:
+
+ * Better error handling for the mail handler: If something
+ goes awry during message reception a error report is sent
+ to the email address set as the admin email. Furthermore,
+ there is now some tests to see if an incoming message is
+ just a bounce message so that infinite mail loops are
+ avoided. Removed all such tests from the email accepter
+ standalone script to simplify it.
+
+ Bugs fixed:
+
+ * An incoming message subject line is now always mime-decoded
+ so that it does not show up with garbage mime code. (Tracker
+ issue 205, thanks go to Alan Milligan)
+
+
1.4
Features added:
diff --git a/Extensions/emailAccepter.py b/Extensions/emailAccepter.py
index f02f400..605891f 100644
--- a/Extensions/emailAccepter.py
+++ b/Extensions/emailAccepter.py
@@ -11,13 +11,13 @@
#####################################################################
__version__='$Revision$'[11:-2]
-import rfc822, cStringIO, sys, urllib
+import sys, urllib
-JTRACKER_EMAIL = 'jtracker@my.org'
JTRACKER_URL = 'http://server.my.org:8080/tracker'
LOGIN = None # Use None if anonymous access is sufficient
PASSWORD = None # Use None if anonymous access is sufficient
+
class JTrackerURLopener(urllib.FancyURLopener):
""" Overriding the method that provides the username/password... """
@@ -29,19 +29,7 @@ class JTrackerURLopener(urllib.FancyURLopener):
if __name__ == '__main__':
# Called from the command line: We received an email
email_text = sys.stdin.read()
- rfc_email = rfc822.Message(cStringIO.StringIO(email_text))
- to_addr = rfc_email.get('envelope-to', rfc_email.get('to',''))
urllib._urlopener = JTrackerURLopener()
-
- if not to_addr or to_addr.find(JTRACKER_EMAIL) == -1:
- sys.exit(1)
-
- subj = rfc_email.get('subject', '').lower()
- if subj.find('undeliverable:') != -1 or subj.find('returned mail:') != -1:
- # Got a bounce message, those are hard to detect
- # This attempt at detecting it is really lame.
- sys.exit(0)
-
url = '%s/receiveMail' % JTRACKER_URL
encoded_email = urllib.urlencode({'file' : email_text})
diff --git a/utils.py b/utils.py
index 75c4472..d414e8c 100644
--- a/utils.py
+++ b/utils.py
@@ -164,8 +164,8 @@ by %(requester_name)s (%(requester_email)s):
Sent automatically by JTracker "%(jtracker_title)s" at %(jtracker_url)s
"""
-MAIL_ERROR_TEMPLATE = """Fatal mail errors by %(requester_name)s \
-(%(requester_email)s):
+MAIL_ERROR_TEMPLATE = """Fatal mail errors receiving mail from \
+%(requester_name)s (%(requester_email)s):
Subject: %(subject)s