source: WAeUP_SRP/base/skins/waeup_default/mail2admin.py @ 2293

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

better string formatting please test

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1## Script (Python) "mail2admin"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=fullname=None,regno=None,email=None,probtype=None,descr=None,commt=None
8##title=
9##
10# $Id: mail2admin.py 2293 2007-09-29 18:19:07Z joachim $
11
12mhost = context.MailHost
13prop = context.portal_properties
14
15# the message format, %s will be filled in from data
16
17# message = """
18# From: %s <%s>
19# To: %s
20# Cc: %s
21# Bcc: %s
22# Reply-To: %s
23# Subject: Uniben Contact
24
25# Fullname: %s
26# Member ID: %s
27# Problem Type: %s
28# Description: %s
29# """
30# msg = message % (
31#      fullname,
32#      email,
33#      prop.email_from_address,
34#      email,
35#      'henrik@waeup.org',
36# #    'js@aixtraware.de',
37#      email,
38#      fullname,
39#      regno,
40#      probtype,
41#      descr,
42#      )
43d = {}
44d['fullname'] = fullname
45d['email'] = email
46d['email_from'] = prop.email_from_address
47d['regno'] = regno
48d['probtype'] = probtype
49d['descr'] = descr
50
51message = """
52From: %(fullname)s <%(email)s>
53To: %(email_from)s
54Cc: %(email)s
55Bcc: 'henrik@waeup.org'
56Reply-To: %(email)s
57Subject: Uniben Contact
58
59Fullname: %(fullname)s
60Member ID: %(regno)s
61Problem Type: %(probtype)s
62Description: %(descr)s
63"""
64
65#prop.email_from_address should be used for To:
66
67mhost.send(msg % d)
68
69REQUEST = context.REQUEST
70RESPONSE = REQUEST.RESPONSE
71
72redirect_url = REQUEST.HTTP_REFERER
73redirect_url = '%s/?%s' % (redirect_url,'portal_status_message=Your message has been sent!')
74RESPONSE.redirect(redirect_url)
Note: See TracBrowser for help on using the repository browser.