Last change
on this file since 8794 was
4012,
checked in by Henrik Bettermann, 16 years ago
|
customize mail2student.py only for Uniben
|
File size:
1.1 KB
|
Line | |
---|
1 | ## Script (Python) "mail2student"
|
---|
2 | ##bind container=container
|
---|
3 | ##bind context=context
|
---|
4 | ##bind namespace=
|
---|
5 | ##bind script=script
|
---|
6 | ##bind subpath=traverse_subpath
|
---|
7 | ##parameters=co_name=None,co_email=None,student_email=None,probtype=None,commt=None, action=None
|
---|
8 | ##title=
|
---|
9 | ##
|
---|
10 | # $Id: mail2admin.py 869 2006-11-15 13:46:49Z henrik $
|
---|
11 |
|
---|
12 | from urllib import urlencode
|
---|
13 |
|
---|
14 | mhost = context.MailHost
|
---|
15 | prop = context.portal_properties
|
---|
16 | REQUEST = context.REQUEST
|
---|
17 |
|
---|
18 | d = {}
|
---|
19 | d['co_name'] = co_name
|
---|
20 | d['co_email'] = co_email
|
---|
21 | #d['co_name'] = prop.email_from_name
|
---|
22 | #d['co_email'] = prop.email_from_address
|
---|
23 | d['student_email'] = student_email
|
---|
24 | d['probtype'] = probtype
|
---|
25 | d['commt'] = commt
|
---|
26 |
|
---|
27 | message = """
|
---|
28 | From: %(co_name)s <%(co_email)s>
|
---|
29 | To: %(student_email)s
|
---|
30 | Cc: %(co_email)s
|
---|
31 | Reply-To: %(co_email)s
|
---|
32 | Subject: %(probtype)s
|
---|
33 | %(commt)s
|
---|
34 | """
|
---|
35 |
|
---|
36 | mhost.send(message % d)
|
---|
37 |
|
---|
38 | args = {}
|
---|
39 | psm = "Your message has been sent!"
|
---|
40 | args['portal_status_message'] = psm
|
---|
41 | if action:
|
---|
42 | url = context.absolute_url() + '/' + action + '?' + urlencode(args)
|
---|
43 | else:
|
---|
44 | url = context.absolute_url() +'?' + urlencode(args)
|
---|
45 | return REQUEST.RESPONSE.redirect(url) |
---|
Note: See
TracBrowser for help on using the repository browser.