Last change
on this file since 2714 was
2316,
checked in by Henrik Bettermann, 17 years ago
|
Some changes to make PRE-NCE application work.
mail2student.py: senders name and email address changed
|
File size:
1.1 KB
|
Rev | Line | |
---|
[891] | 1 | ## Script (Python) "mail2student"
|
---|
| 2 | ##bind container=container
|
---|
| 3 | ##bind context=context
|
---|
| 4 | ##bind namespace=
|
---|
| 5 | ##bind script=script
|
---|
| 6 | ##bind subpath=traverse_subpath
|
---|
[1595] | 7 | ##parameters=co_name=None,co_email=None,student_email=None,probtype=None,commt=None, action=None
|
---|
[891] | 8 | ##title=
|
---|
| 9 | ##
|
---|
| 10 | # $Id: mail2admin.py 869 2006-11-15 13:46:49Z henrik $
|
---|
| 11 |
|
---|
[1598] | 12 | from urllib import urlencode
|
---|
| 13 |
|
---|
[891] | 14 | mhost = context.MailHost
|
---|
| 15 | prop = context.portal_properties
|
---|
[2294] | 16 | REQUEST = context.REQUEST
|
---|
[891] | 17 |
|
---|
[2294] | 18 | d = {}
|
---|
[2316] | 19 | #d['co_name'] = co_name
|
---|
| 20 | #d['co_email'] = co_email
|
---|
| 21 | d['co_name'] = 'CRPU Uniben'
|
---|
| 22 | d['co_email'] = prop.email_from_address
|
---|
[2294] | 23 | d['student_email'] = student_email
|
---|
| 24 | d['probtype'] = probtype
|
---|
| 25 | d['commt'] = commt
|
---|
[1595] | 26 |
|
---|
[2294] | 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 | """
|
---|
[891] | 35 |
|
---|
[2296] | 36 | mhost.send(message % d)
|
---|
[891] | 37 |
|
---|
[1595] | 38 | args = {}
|
---|
| 39 | psm = "Your message has been sent!"
|
---|
| 40 | args['portal_status_message'] = psm
|
---|
[1608] | 41 | if action:
|
---|
| 42 | url = context.absolute_url() + '/' + action + '?' + urlencode(args)
|
---|
| 43 | else:
|
---|
| 44 | url = context.absolute_url() +'?' + urlencode(args)
|
---|
[2296] | 45 | return REQUEST.RESPONSE.redirect(url) |
---|
Note: See
TracBrowser for help on using the repository browser.