source: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_student/mail2student.py @ 9681

Last change on this file since 9681 was 1608, checked in by Henrik Bettermann, 18 years ago

new email address for forwarding

File size: 1.5 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
12from urllib import urlencode
13
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:
30REQUEST = context.REQUEST
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
40msg = message % (
41     co_name,
42     co_email,
43     student_email,
44     co_email,
45     'waeup@saoas.org',
46#    'js@aixtraware.de',
47     co_email,
48     probtype,
49     commt,
50     )
51mhost.send(msg)
52
53
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.