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

Last change on this file since 2294 was 2294, checked in by joachim, 17 years ago

same

File size: 1.4 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
16REQUEST = context.REQUEST
17
18# the message format, %s will be filled in from data
19
20# message = """
21# From: %s <%s>
22# To: %s
23# Cc: %s
24# Reply-To: %s
25# Subject: %s
26# %s
27# """
28
29#prop.email_from_address should be used for To:
30
31# msg = message % (
32#      co_name,
33#      co_email,
34#      student_email,
35#      co_email,
36#      co_email,
37#      probtype,
38#      commt,
39#      )
40d = {}
41d['co_name'] = co_name
42d['co_email'] = co_email
43d['student_email'] = student_email
44d['probtype'] = probtype
45d['commt'] = commt
46
47message = """
48From: %(co_name)s <%(co_email)s>
49To: %(student_email)s
50Cc: %(co_email)s
51Reply-To: %(co_email)s
52Subject: %(probtype)s
53%(commt)s
54"""
55
56mhost.send(msg % d)
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
Note: See TracBrowser for help on using the repository browser.