Code

- added Windows Service mode for roundup-server when daemonification is
[roundup.git] / scripts / roundup-reminder
index ad7ca425efa7b0d377f5807996aba98bbcc7b3cb..922fe62d52bfe371216f2bb3688cc2ebefdd7804 100755 (executable)
@@ -19,7 +19,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-# $Id: roundup-reminder,v 1.3 2002-09-10 01:07:06 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
 
 '''
 Simple script that emails all users of a tracker with the issues that
@@ -32,8 +32,9 @@ Note: The instance that this script was designed for has a modified schema!
       You will want to modify this script to customise it for your own schema!
 '''
 
       You will want to modify this script to customise it for your own schema!
 '''
 
-import cStringIO, MimeWriter, smtplib
+import sys, cStringIO, MimeWriter, smtplib
 from roundup import instance, date
 from roundup import instance, date
+from roundup.mailgw import openSMTPConnection
 
 # open the instance
 if len(sys.argv) != 2:
 
 # open the instance
 if len(sys.argv) != 2:
@@ -73,14 +74,14 @@ for user_id in db.user.list():
     # generate the email message
     message = cStringIO.StringIO()
     writer = MimeWriter.MimeWriter(message)
     # generate the email message
     message = cStringIO.StringIO()
     writer = MimeWriter.MimeWriter(message)
-    writer.addheader('Subject', 'Your active %s issues'%db.config.INSTANCE_NAME)
+    writer.addheader('Subject', 'Your active %s issues'%db.config.TRACKER_NAME)
     writer.addheader('To', address)
     writer.addheader('To', address)
-    writer.addheader('From', '%s <%s>'%(db.config.INSTANCE_NAME,
+    writer.addheader('From', '%s <%s>'%(db.config.TRACKER_NAME,
         db.config.ADMIN_EMAIL))
         db.config.ADMIN_EMAIL))
-    writer.addheader('Reply-To', '%s <%s>'%(db.config.INSTANCE_NAME,
+    writer.addheader('Reply-To', '%s <%s>'%(db.config.TRACKER_NAME,
         db.config.ADMIN_EMAIL))
     writer.addheader('MIME-Version', '1.0')
         db.config.ADMIN_EMAIL))
     writer.addheader('MIME-Version', '1.0')
-    writer.addheader('X-Roundup-Name', db.config.INSTANCE_NAME)
+    writer.addheader('X-Roundup-Name', db.config.TRACKER_NAME)
 
     # start the multipart
     part = writer.startmultipartbody('alternative')
 
     # start the multipart
     part = writer.startmultipartbody('alternative')
@@ -110,7 +111,7 @@ To view or respond to any of the issues listed above, visit the URL
    %s
 
 and click on "My Issues". Do NOT respond to this message.
    %s
 
 and click on "My Issues". Do NOT respond to this message.
-'''%db.config.ISSUE_TRACKER_WEB
+'''%db.config.TRACKER_WEB
 
 
     # now the HTML one
 
 
     # now the HTML one
@@ -132,7 +133,7 @@ and click on "My Issues". Do NOT respond to this message.
             creation = creation_date.pretty()
         if not timeliness_id: timeliness_id = ' '
         title = db.issue.get(issue_id, 'title')
             creation = creation_date.pretty()
         if not timeliness_id: timeliness_id = ' '
         title = db.issue.get(issue_id, 'title')
-        issue_id = '<a href="%sissue%s">%s</a>'%(db.config.ISSUE_TRACKER_WEB,
+        issue_id = '<a href="%sissue%s">%s</a>'%(db.config.TRACKER_WEB,
             issue_id, issue_id)
         colour = colours.get(timeliness, '')
         print >>body, '''<tr%s><td>%s</td><td>%s</td><td>%s</td>
             issue_id, issue_id)
         colour = colours.get(timeliness, '')
         print >>body, '''<tr%s><td>%s</td><td>%s</td><td>%s</td>
@@ -147,7 +148,7 @@ and click on "My Issues". Do NOT respond to this message.
     writer.lastpart()
 
     # all done, send!
     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
     smtp.sendmail(db.config.ADMIN_EMAIL, address, message.getvalue())
 
 # vim: set filetype=python ts=4 sw=4 et si