source: WAeUP_SRP/base/skins/waeup_student/mail2student.py @ 2277

Last change on this file since 2277 was 2261, checked in by Henrik Bettermann, 17 years ago

don't cc emails to students

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     co_email,
46     probtype,
47     commt,
48     )
49mhost.send(msg)
50
51
52#REQUEST = context.REQUEST
53#RESPONSE = REQUEST.RESPONSE
54#RESPONSE.redirect(redirect_url)
55
56args = {}
57psm = "Your message has been sent!"
58args['portal_status_message'] = psm
59if action:
60    url = context.absolute_url() + '/' + action + '?' + urlencode(args)
61else:
62    url = context.absolute_url() +'?' + urlencode(args)
63return REQUEST.RESPONSE.redirect(url)
64
Note: See TracBrowser for help on using the repository browser.