Re: E-mails no longer being sent to a specific user account

"Kaplan, Andrew H." <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hello --

The script in question has been enclosed with this e-mail. Thanks for your help in advance.

 

-----Original Message-----
From: Bernhard Reiter [mailto:[email protected]] 
Sent: Friday, September 28, 2012 4:22 AM
To: [email protected]
Subject: Re: [Roundup-users] E-mails no longer being sent to a specific user account

Hi Kaplan,

Am Donnerstag, 27. September 2012 16:18:14 schrieb Kaplan, Andrew H.:
> I had implemented the roundup-reminder.py script on our server, and had it
> scheduled to run once every two hours. When there was only one user account
> on the server, the e-mail notifications worked without any problem.

can you give us access to the precise script you are using (without passwords 
of course) and the behaviour you would be expecting?
This may help us help you to diagnose the issue.

> Recently I added another user account to the server, and I have noticed
> that the e-mail notifications appear to be going to the new account, but no
> longer to the original account. I checked the mail.log file on the server,
> and there are entries that read as follows:
>
> Sep 27 10:04:31 roundup postfix/smtp[19150]: 66189DB6167: to=<new email
> account>...status=sent (250 ok:  Message 252990724 accepted)
>
> There are no entries similar to this for the original account. What is
> present for the older account is the following:
>
> Sep 27 10:04:31 roundup postfix/qmgr[1100]: 66189DB6167: from=<original
> email account>, size=1904, nrcpt=1 (queue active)
>
> Why would this occur, and how can I correct it?

Best Regards,
Bernhard

-- 
www.intevation.de/~bernhard (CEO)    www.fsfe.org (Founding GA Member)
Intevation GmbH, Osnabrück, DE; Amtsgericht Osnabrück, HRB 18998
Geschäftsführer Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html

_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users
roundup-reminder.py (application/octet-stream, 6.1 KB)
#! /usr/bin/env python
# Copyright (c) 2002 ekit.com Inc (http://www.ekit-inc.com/)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. 

'''
Simple script that emails all users of a tracker with the issues that
are currently assigned to them.

TODO: introduce some structure ;)
TODO: possibly make this more general and configurable...
'''

import sys, cStringIO, MimeWriter, smtplib
from roundup import instance, date
from roundup.mailer import SMTPConnection

# open the instance
if len(sys.argv) != 2:
   print 'You need to specify an instance home dir'
instance_home = sys.argv[1]
instance = instance.open(instance_home)
db = instance.open('admin')

resolved_id = db.status.lookup('resolved')

def listCompare(x, y): 
     "compare two tuples such that order is positive on [0] and negative on [1]"
     if x[0] < y[0]:
         return -1
     if x[0] > y[0]:
         return 1
     if x[1] > y[1]:
         return -1
     if x[1] < y[1]:
         return 1
     return 0

# loop through all the users
for user_id in db.user.list():
    # make sure we care aboue this user
    name = db.user.get(user_id, 'realname')
    if name is None:
        name = db.user.get(user_id, 'username')
    address = db.user.get(user_id, 'address')
    if address is None:
        continue

    # extract this user's issues 
    l = []
    for issue_id in db.issue.find(assignedto=user_id):
        if db.issue.get(issue_id, 'status') == resolved_id:
            continue
        order = db.priority.get(db.issue.get(issue_id, 'priority'), 'order')
        l.append((order, db.issue.get(issue_id, 'activity'),
             db.issue.get(issue_id, 'creation'), issue_id))

    # sort the issues by timeliness and creation date
    l.sort(listCompare)
    if not l:
        continue

    # generate the email message
    message = cStringIO.StringIO()
    writer = MimeWriter.MimeWriter(message)
    writer.addheader('Subject', 'Your active %s issues'%db.config.TRACKER_NAME)
    writer.addheader('To', address)
    writer.addheader('From', '%s <%s>'%(db.config.TRACKER_NAME,
         db.config.ADMIN_EMAIL))
    writer.addheader('Reply-To', '%s <%s>'%(db.config.TRACKER_NAME,
         db.config.ADMIN_EMAIL))
    writer.addheader('MIME-Version', '1.0')
    writer.addheader('X-Roundup-Name', db.config.TRACKER_NAME) 

    # start the multipart
    part = writer.startmultipartbody('alternative')
    part = writer.nextpart()
    body = part.startbody('text/plain')

    # do the plain text bit
    print >>body, 'Created      ID    Activity  Title'
    print >>body, '='*75
    #                   '2 months   213  immediate cc_daemon barfage
    old_priority = None
    for priority_order, activity_date, creation_date, issue_id in l:
        priority = db.issue.get(issue_id, 'priority')
        if (priority != old_priority):
           old_priority = priority
           print >>body, '    ', db.priority.get(priority,'name')
        # pretty creation
        creation = (creation_date - date.Date('.')).pretty()
        if creation is None:
            creation = creation_date.pretty()
        activity = (activity_date - date.Date('.')).pretty()
        title = db.issue.get(issue_id, 'title')
        if len(title) > 42:
            title = title[:38] + ' ...' 
        print >>body, '%-11s %-4s %-9s %-42s'%(creation, issue_id,
             activity, title)

     # some help to finish off
    print >>body, '''
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.
'''%db.config.TRACKER_WEB


     # now the HTML one
    part = writer.nextpart()
    body = part.startbody('text/html')
    colours = {
             'immediate': ' bgcolor="#ffcdcd"',
             'day': ' bgcolor="#ffdecd"',
             'week': ' bgcolor="#ffeecd"',
             'month': ' bgcolor="#ffffcd"',
             'whenever': ' bgcolor="#ffffff"',
     } 
    print >>body, '''<table border>
<tr><th>Created</th> <th>ID</th> <th>Activity</th> <th>Title</th></tr>
'''
old_priority = None
for priority_order, activity_date, creation_date, issue_id in l:
           priority = db.issue.get(issue_id,'priority')
           if (priority != old_priority):
              old_priority = priority
              print >>body, '<tr><td>-></td><td>-></td><td>-></td><td><b>%s</b></td></tr>'%db.priority.get(priority,'name')
           creation = (creation_date - date.Date('.')).pretty()
           if creation is None:
               creation = (creation_date - date.Date('.')).pretty()
           title = db.issue.get(issue_id, 'title')
           issue_id = '<a href="%sissue%s">%s</a>'%(db.config.TRACKER_WEB,
                 issue_id, issue_id)
           activity = (activity_date - date.Date('.')).pretty()
           print >>body, '''<tr><td>%s</td><td>%s</td><td>%s</td>
    <td>%s</td></tr>'''%(creation, issue_id, activity, title)
print >>body, '</table>'

print >>body, '''<p>To view or respond to any of the issues listed
         above, simply click on the issue ID. Do <b>not</b> respond to
         this message.</p>'''

# finish of the multipart
writer.lastpart()

# all done, send!
smtp = SMTPConnection(db.config)
smtp.sendmail(db.config.ADMIN_EMAIL, address, message.getvalue())

# vim: set filetype=python ts=4 sw=4 et si
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.