summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5f9c7f7)
raw | patch | inline | side by side (parent: 5f9c7f7)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 24 Apr 2003 07:20:00 +0000 (07:20 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 24 Apr 2003 07:20:00 +0000 (07:20 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1680 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/CHANGES.txt b/CHANGES.txt
index 7b059988527539636b8ad724cc5d6b8ca412f6d6..3c3664cc097a08cf773a6f3db68b268f6a64d11c 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- Roundup templates are now distributed much more sanely, allowing for
3rd-party templates.
- extended date syntax to make range searches even more useful
+- SMTP login and TLS support added (sf bug 710853 with extras ;)
Fixed:
- applied unicode patch. All data is stored in utf-8. Incoming messages
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index 3c59776b5b6d5d7d01484ead40fc89be1966087e..007d7a04315d9eb40ad2b6cbeae9787309b912e3 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.113 2003-04-10 05:12:41 richard Exp $
+# $Id: client.py,v 1.114 2003-04-24 07:19:59 richard Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
from roundup.cgi import cgitb
from roundup.cgi.PageTemplates import PageTemplate
from roundup.rfc2822 import encode_header
-from roundup.mailgw import uidFromAddress
+from roundup.mailgw import uidFromAddress, openSMTPConnection
class HTTPException(Exception):
pass
try:
# send the message as admin so bounces are sent there
# instead of to roundup
- smtp = smtplib.SMTP(self.db.config.MAILHOST)
+ smtp = openSMTPConnection(self.db.config)
smtp.sendmail(self.db.config.ADMIN_EMAIL, [to],
message.getvalue())
except socket.error, value:
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 75dd779948e3737eae1c6aed7f357582030ceaa9..89dd29fc70dd520b8b58353cb6dc6261fab7b585 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.117 2003-04-23 12:09:20 richard Exp $
+$Id: mailgw.py,v 1.118 2003-04-24 07:19:58 richard Exp $
'''
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
return rfc822.unquote(f[i+1:].strip())
return None
+def openSMTPConnection(config):
+ ''' Open an SMTP connection to the mailhost specified in the config
+ '''
+ smtp = smtplib.SMTP(config.MAILHOST)
+
+ # use TLS?
+ use_tls = getattr(config, 'MAILHOST_TLS', 'no')
+ if use_tls == 'yes'
+ # do we have key files too?
+ keyfile = getattr(config, 'MAILHOST_TLS_KEYFILE', None)
+ if keyfile is not None:
+ certfile = getattr(config, 'MAILHOST_TLS_CERTFILE', None)
+ if certfile is not None:
+ args = (keyfile, certfile)
+ else:
+ args = (keyfile, )
+ else:
+ args = ()
+ # start the TLS
+ smtp.starttls(*args)
+
+ # ok, now do we also need to log in?
+ mailuser = getattr(config, 'MAILUSER', None)
+ if mailuser:
+ smtp.login(*config.MAILUSER)
+
+ # that's it, a fully-configured SMTP connection ready to go
+ return smtp
+
class Message(mimetools.Message):
''' subclass mimetools.Message so we can retrieve the parts of the
message...
m.getvalue()))
else:
try:
- smtp = smtplib.SMTP(self.instance.config.MAILHOST)
+ smtp = openSMTPConnection(self.instance.config)
smtp.sendmail(self.instance.config.ADMIN_EMAIL, sendto,
m.getvalue())
except socket.error, value:
# attach the files to the issue
if nodeid:
# extend the existing files list
- fileprop = cl.get(nodeid, 'file')
+ fileprop = cl.get(nodeid, 'files')
fileprop.extend(files)
props['files'] = fileprop
else:
# pre-load the files list
- props['files'] = fileprop
+ props['files'] = files
#
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 1294c80c65c75f07ba75c539ae9eac209f8f4beb..56176a908fdd335ba183cd4f8550a10ace25f64e 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundupdb.py,v 1.84 2003-04-14 06:24:01 richard Exp $
+# $Id: roundupdb.py,v 1.85 2003-04-24 07:19:58 richard Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
return '%s%s%s <%s>' % (quotes, name, quotes, address)
return address
-import hyperdb
+from roundup import hyperdb
+from roundup.mailgw import openSMTPConnection
# set to indicate to roundup not to actually _send_ email
# this var must contain a file to write the mail to
try:
# send the message as admin so bounces are sent there
# instead of to roundup
- smtp = smtplib.SMTP(self.db.config.MAILHOST)
+ smtp = openSMTPConnection(self.db.config)
smtp.sendmail(self.db.config.ADMIN_EMAIL, sendto,
message.getvalue())
except socket.error, value:
index 733d233a8f4b4d0fb792009ef30b1ce01e613f7c..922fe62d52bfe371216f2bb3688cc2ebefdd7804 100755 (executable)
--- a/scripts/roundup-reminder
+++ b/scripts/roundup-reminder
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-# $Id: roundup-reminder,v 1.5 2003-02-06 05:43:49 richard Exp $
+# $Id: roundup-reminder,v 1.6 2003-04-24 07:19:59 richard Exp $
'''
Simple script that emails all users of a tracker with the issues that
import sys, cStringIO, MimeWriter, smtplib
from roundup import instance, date
+from roundup.mailgw import openSMTPConnection
# open the instance
if len(sys.argv) != 2:
writer.lastpart()
# all done, send!
- smtp = smtplib.SMTP(db.config.MAILHOST)
+ smtp = openSMTPConnection(db.config)
smtp.sendmail(db.config.ADMIN_EMAIL, address, message.getvalue())
# vim: set filetype=python ts=4 sw=4 et si
index d507ba933f1cce3b02f18fcfaec5468a6053d27e..8f9057d340cbd076e813bcf2f0aa8d2b0cf09f4e 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: config.py,v 1.2 2003-04-23 11:59:36 richard Exp $
+# $Id: config.py,v 1.3 2003-04-24 07:19:59 richard Exp $
import os
# The SMTP mail host that roundup will use to send mail
MAILHOST = 'localhost'
+# If your SMTP mail host requires a username and password for access, then
+# specify them here.
+# eg. MAILUSER = ('username', 'password')
+MAILUSER = ()
+
+# If your SMTP mail host provides or requires TLS (Transport Layer
+# Security) then set MAILHOST_TLS = 'yes'
+# Optionallly, you may also set MAILHOST_TLS_KEYFILE to the name of a PEM
+# formatted file that contains your private key, and MAILHOST_TLS_CERTFILE
+# to the name of a PEM formatted certificate chain file.
+MAILHOST_TLS = 'no'
+MAILHOST_TLS_KEYFILE = ''
+MAILHOST_TLS_CERTFILE = ''
+
# The domain name used for email addresses.
MAIL_DOMAIN = 'your.tracker.email.domain.example'
index e5e40f2fcd41e7fb38c8b062696cfcc4d01e5ed6..f2d3f677dad655dcb3448054553a98d7c7302a79 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: config.py,v 1.1 2003-04-17 03:27:27 richard Exp $
+# $Id: config.py,v 1.2 2003-04-24 07:20:00 richard Exp $
import os
# The SMTP mail host that roundup will use to send mail
MAILHOST = 'localhost'
+# If your SMTP mail host requires a username and password for access, then
+# specify them here.
+# eg. MAILUSER = ('username', 'password')
+MAILUSER = ()
+
+# If your SMTP mail host provides or requires TLS (Transport Layer
+# Security) then set MAILHOST_TLS = 'yes'
+# Optionallly, you may also set MAILHOST_TLS_KEYFILE to the name of a PEM
+# formatted file that contains your private key, and MAILHOST_TLS_CERTFILE
+# to the name of a PEM formatted certificate chain file.
+MAILHOST_TLS = 'no'
+MAILHOST_TLS_KEYFILE = ''
+MAILHOST_TLS_CERTFILE = ''
+
# The domain name used for email addresses.
MAIL_DOMAIN = 'your.tracker.email.domain.example'