source: WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py @ 9819

Last change on this file since 9819 was 1653, checked in by uli, 18 years ago

Incorporated changeset 1593:1652 of trunk into uli-branch.

File size: 1.5 KB
RevLine 
[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
[1653]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
[1653]12from urllib import urlencode
13
[891]14mhost = context.MailHost
15prop = context.portal_properties
16
17# the message format, %s will be filled in from data
18
19message = """
20From: %s <%s>
21To: %s
22Cc: %s
23Bcc: %s
24Reply-To: %s
25Subject: %s
26%s
27"""
28
29#prop.email_from_address should be used for To:
[909]30REQUEST = context.REQUEST
[1653]31
32#url_tuple = REQUEST.HTTP_REFERER.split('?')
33#if len(url_tuple) == 2:
34#    url_tuple[1] ='portal_status_message=Your message has been sent!'
35#else:
36#    url_tuple.append('portal_status_message=Your message has been sent!')
37#redirect_url = "?".join(url_tuple)
38#REQUEST.set('rurl', redirect_url) # to see the result in the error log
39
[891]40msg = message % (
41     co_name,
42     co_email,
[1593]43     student_email,
[891]44     co_email,
[1653]45     'waeup@saoas.org',
[891]46#    'js@aixtraware.de',
47     co_email,
48     probtype,
49     commt,
50     )
51mhost.send(msg)
52
53
[1653]54#REQUEST = context.REQUEST
55#RESPONSE = REQUEST.RESPONSE
56#RESPONSE.redirect(redirect_url)
57
58args = {}
59psm = "Your message has been sent!"
60args['portal_status_message'] = psm
61if action:
62    url = context.absolute_url() + '/' + action + '?' + urlencode(args)
63else:
64    url = context.absolute_url() +'?' + urlencode(args)
65return REQUEST.RESPONSE.redirect(url)
66
67
68
Note: See TracBrowser for help on using the repository browser.