[PloneDavis-Discuss] Email Notification on transisiton
Hello all,
I'm trying to get email notifications when someone submits a page for
review. I'm currently using Plone 2.5 with UCDPloneSkin and CAS for
authentication. I've been following this how-to paying particular
attention to the External Method reply:
http://plone.org/documentation/how-to/send-mail-on-workflow-transition/
My scripts are pretty much identical to the one posted in the "Getting
around permissions problems with an external method" submission on that
page. I'm not real familiar with python and scripting for plone so it's
just copy and try to comprehend for me. I've gotten to the point where
on submission, the error I get is "Error Type: MailHostError; Error
Value: No message recipient designated." I'm guessing that the script
is not finding appropriate recipients for the message. I want this
message sent to anyone that has the "reviewer" role.
I've attached the external method script. The redirect script is pretty
much just one line:
context.submitNotification(state_change,context)
with state_change in the Parameter List.
Thanks for any help. This should be an easy one for you Plone/Zope gurus.
--
Huy Tran
Programmer II
Department of Music
Department of Theatre and Dance
One Shields Ave
Davis, CA 95616
hqttran@...
(530) 752-4716 - Music
(530) 752-4635 - Theatre & Dance
(530) 752-0983 - Fax
def submitNotification(self,state,context):
obj = state.object
creator = obj.Creator()
history = state.getHistory()
wf_tool = context.portal_workflow
mMsg = """
This is an automated submission notification. You may reply
to the sender of this message if you have questions.
Website content has been submitted for review.
The content was submitted by %s.
The url is %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 = 'Website content awaits review'
obj_url = obj.absolute_url() #use portal_url + relative_url
creatorName = creator['fullname']
message = mMsg % (creatorName, obj_url)
context.MailHost.send(message, mTo, mFrom, mSubj)
_______________________________________________
ZUGOD-Discuss mailing list
ZUGOD-Discuss@...
http://www2.dcn.org/mailman/listinfo/zugod-discuss