def sendmail(workitem, subject='djflow.apptools sendmail message', template='djflow/app_sendmail.txt'): '''send a mail notification to the workitem user. parameters: subject default='djflow.apptools sendmail message' template default='djflow/app_sendmail.txt' ''' send_mail(workitems=(workitem,), user=workitem.user, subject=subject, template=template)
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)
def sendmail(workitem, subject='djflow.apptools sendmail message', template='djflow/app_sendmail.txt'): '''send a mail notification to the workitem user. parameters: subject default='djflow.apptools sendmail message' template default='djflow/app_sendmail.txt' ''' send_mail(workitems=(workitem, ), user=workitem.user, subject=subject, template=template)