Example #1
0
 def send_wfmail(self, profile, workitems, user, subject, template):
     try :
         send_mail(workitems=workitems, user=user, subject=subject, template=template)
         profile.notif_sent()
         log.info('notification sent to %s' % user.username)
     except Exception, v:
         log.error('sendmail error: %s' % v)
Example #2
0
def sendmail(workitem, subject='goflow.apptools sendmail message', template='goflow/app_sendmail.txt'):
    '''send a mail notification to the workitem user.
    
    parameters:
    
    subject
        default='goflow.apptools sendmail message'
    template
        default='goflow/app_sendmail.txt'
    '''
    send_mail(workitems=(workitem,), user=workitem.user, subject=subject, template=template)
Example #3
0
def sendmail(workitem, subject='goflow.apptools sendmail message', template='goflow/app_sendmail.txt'):
    '''send a mail notification to the workitem user.
    
    parameters:
    
    subject
        default='goflow.apptools sendmail message'
    template
        default='goflow/app_sendmail.txt'
    '''
    send_mail(workitems=(workitem,), user=workitem.user, subject=subject, template=template)
Example #4
0
 def notify_if_needed(self, user=None, roles=None):
     ''' notify user if conditions are fullfilled
     '''
     if user:
         workitems = self.list_safe(user=user, notstatus='complete', noauto=True)
         profile, created = UserProfile.objects.get_or_create(user=user)
         if len(workitems) >= profile.nb_wi_notif:
             try:
                 if profile.check_notif_to_send():
                     send_mail(workitems=workitems, user=user, subject='message', template='mail.txt')
                     profile.notif_sent()
                     log.info('notification sent to %s' % user.username)
             except Exception, v:
                 log.error('sendmail error: %s' % v)
Example #5
0
 def notify_if_needed(self, user=None, roles=None):
     """ notify user if conditions are fullfilled
     """
     if user:
         workitems = self.list_safe(user=user, notstatus="complete", noauto=True)
         UserProfile.objects.get_or_create(user=user)
         profile = user.get_profile()
         if len(workitems) >= profile.nb_wi_notif:
             try:
                 if profile.check_notif_to_send():
                     send_mail(workitems=workitems, user=user, subject="message", template="mail.txt")
                     profile.notif_sent()
                     log.info("notification sent to %s" % user.username)
             except Exception, v:
                 log.error("sendmail error: %s" % v)
Example #6
0
 def notify_if_needed(self, user=None, roles=None):
     ''' notify user if conditions are fullfilled
     '''
     if user:
         workitems = self.list_safe(user=user, notstatus='complete', noauto=True)
         profile, created = UserProfile.objects.get_or_create(user=user)
         if len(workitems) >= profile.nb_wi_notif:
             try:
                 if profile.check_notif_to_send():
                     send_mail(workitems=workitems, user=user, subject='message', template='mail.txt')
                     profile.notif_sent()
                     log.info('notification sent to %s' % user.username)
             except Exception as v:
                 log.error('sendmail error: %s' % v)
     return
Example #7
0
#!/usr/local/bin/python