I am only guessing as I have never done python code before, but i have had another look at the code and was wondering if anyone knew if the below code needs a for loop to look through members in plone and email out members with a certain permission like Manager instead of just emailing 1 member like the below code does.
obj=sti.object creator = obj.Creator() history = sti.getHistory() wf_tool = context.portal_workflow mMsg = """ Content has been submitted for your review. The url was %s. The reason was %s. """ member = context.portal_membership.getMemberById(creator) creator = {'member':member, 'id':member.getId(), 'fullname':member.getProperty('fullname', 'Fullname missing'), 'email':member.getProperty('email', None)} actorid = wf_tool.getInfoFor(obj, 'actor') actor = context.portal_membership.getMemberById(actorid) reviewer = {'member':actor, 'id':actor.getId(), 'fullname':actor.getProperty('fullname', 'Fullname missing'), 'email':actor.getProperty('email', None)} mTo = reviewer['email'] mFrom = creator['email'] mSubj = 'Your item has transitioned' obj_url = obj.absolute_url() #use portal_url + relative_url comments = wf_tool.getInfoFor(obj, 'comments') message = mMsg % (obj_url, comments) context.MailHost.send(message, mTo, mFrom, mSubj) The loop i was thinking of was for user in context.portal_membership.listMembers(): if "Manager" in context.portal_membership.getMemberById(user.id).getRoles(): But unsure of whether this is right and how to implement this into the code. Does anybody have any thoughts at all? -- View this message in context: http://www.nabble.com/Automated-email-response-tf3540615.html#a9984870 Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list