473,325 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Automated email response


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

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
that?

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

%s

URL: %s
"""

for user in mship.listMembers():
if "Reviewer" in mship.getMemberById(user.id).getRoles():
if user.email:
msg = message % (
administratorEmailAddress,
user.email,
object.TitleOrId(),
object.Description(),
object.absolute_url()
)
mhost.send(msg)

--
View this message in context: http://www.nabble.com/Automated-emai....html#a9883575
Sent from the Python - python-list mailing list archive at Nabble.com.

Apr 7 '07 #1
0 1325

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
3
by: Bryan Capps | last post by:
I'm developing an ms-access db which keeps track of some insurance claims. When I recieve a new claim, I want to be able to have the db create a standard set of folders for that claim, if they...
0
by: Lee Harris | last post by:
Hello, I have a client that has about 150 users on a intranet that I've created. The server is Windows 2000 with IIS 5.0 and has Office 2000 installed. The client came to me and asked if it was...
3
by: Smithers | last post by:
I have indeed googled this group and googled the 'net, and what I came up with was that if I want to have an automated process that ZIPs a file, I need to come up with 600 bucks for PKWare's server...
6
by: brettev | last post by:
World, I work at a university where the professors have a system to input grades for assignments and calculate final grades, which is output to an excel file. they are then required to get on a...
3
by: aj | last post by:
DB2 LUW 8.2 FP14 Red Hat AS 2.1 I am using a response file w/ db2setup to install DB2. I then want to install the latest fixpak in the same automated way. Is there any way to use a response...
0
by: therig | last post by:
I'm using the following code to send a welcome letter to a user after they've registered with their username/password. Everything seems to work, but when I test the registration with my squirrelmail...
7
by: Jeff | last post by:
Hey ..NET 2.0 I'm on a project where I'm now about to develop the Data Access Layer. The database have 300 stored procedures. I'm about to go on a time consuming process of writing the .NET...
6
by: Karl | last post by:
Hi all, It may seem like a rather odd request (or not) but I would like to be able to create a file (doc, jpg, xls or one of many other files that can be automated) on a website and stream it to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.