473,732 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getM emberById(creat or)
creator = {'member':membe r,
'id':member.get Id(),
'fullname':memb er.getProperty( 'fullname', 'Fullname missing'),
'email':member. getProperty('em ail', None)}

actorid = wf_tool.getInfo For(obj, 'actor')
actor = context.portal_ membership.getM emberById(actor id)
reviewer = {'member':actor ,
'id':actor.getI d(),
'fullname':acto r.getProperty(' fullname', 'Fullname missing'),
'email':actor.g etProperty('ema il', None)}

mTo = reviewer['email']
mFrom = creator['email']
mSubj = 'Your item has transitioned'
obj_url = obj.absolute_ur l() #use portal_url + relative_url
comments = wf_tool.getInfo For(obj, 'comments')

message = mMsg % (obj_url, comments)
context.MailHos t.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.ob ject
mship = context.portal_ membership
mhost = context.MailHos t
administratorEm ailAddress = context.email_f rom_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.listMembe rs():
if "Reviewer" in mship.getMember ById(user.id).g etRoles():
if user.email:
msg = message % (
administratorEm ailAddress,
user.email,
object.TitleOrI d(),
object.Descript ion(),
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 1346

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

Similar topics

21
3919
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 adresses and so on. I thought it might be a better way to programm an automated, dynamic form validation that works for all kinds of fields, shows the necessary error messages and highlights the coresponding form fields.
3
1646
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 don't already exist, by combining/concatenating (1) claim-specific information in one table with (2) a table of standard folder names that should exist for all claims. I've considered various types of queries and some Visual Basic solutions, but my...
0
2054
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 possible to print MS Word and Excel docuements right from the ASP page. First I said sure I'll just link the document to the page then you can print it. That's not what they wanted, they wanted to be able to click on a link and have the server...
3
1325
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 product. There has to be something much much much more affordable than that. I'd appreciate any recommendations for how I could proceed to automate the zipping of files on Windows Server 2003 (standard). I don't mind writing a batch file...
6
3055
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 different system and click radio buttons in a form to input final grades. i would like to automate this by doing some sort of automated form submission that grabs the information from the excel sheet and selects the correct radio button and then...
3
2818
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 file w/ fixpak installation? Or can I otherwise do an automated (non-interactive) fixpak install?
0
1225
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 accounts and comcast account, I don't receive the email, Gmail & some other accounts work fine. Any help would be greatly appreciated. Thanks in advance. Lee <% errorMsg=""
7
1535
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 code which calls all these stored procedures. Each stored procedure should get it's own method in the Data Acess Layer..
6
3366
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 a user without saving it to the disk first. Obviously saving the file first and streaming it afterwards is fairly easy to do, but it relies on disk write permissions on the server and you'd have to make sure the file was removed afterwards.
0
8773
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9234
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.