Automated email response

tonydevlin anthonydevine69 at
Sat Apr 7 14:24:31 CEST 2007

I currently have the python code 
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, 
           '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, 
            '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) 

This is attached to a transitions in a workflow and when a user selects the
transition they are emailed. I want it to email all of the users or selected
members like managers.  How would I go about changing the above code to do

I have tried the following code from the definitve guide to plone book, but
it does not have any effect on my workflow and does not email anyone.  Is
there something that I need to change on my setting possibly in Plone to get
the email response working, I have set up my mailhost and this works because
when I add a new user it emails them. 

# the objects we need 
object = state_change.object 
mship = context.portal_membership 
mhost = context.MailHost 
administratorEmailAddress = context.email_from_address 
# the message format, %s will be filled in from data 
message = """ 
From: %s 
To: %s 
Subject: New item submitted for approval - %s 
URL: %s 

for user in mship.listMembers(): 
    if "Reviewer" in mship.getMemberById( 
            msg = message % ( 

View this message in context:
Sent from the Python - python-list mailing list archive at

More information about the Python-list mailing list