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 |
|
---|
12 | mhost = context.MailHost
|
---|
13 | prop = 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 | # )
|
---|
43 | d = {}
|
---|
44 | d['fullname'] = fullname
|
---|
45 | d['email'] = email
|
---|
46 | d['email_from'] = prop.email_from_address
|
---|
47 | d['regno'] = regno
|
---|
48 | d['probtype'] = probtype
|
---|
49 | d['descr'] = descr
|
---|
50 |
|
---|
51 | message = """
|
---|
52 | From: %(fullname)s <%(email)s>
|
---|
53 | To: %(email_from)s
|
---|
54 | Cc: %(email)s
|
---|
55 | Bcc: 'henrik@waeup.org'
|
---|
56 | Reply-To: %(email)s
|
---|
57 | Subject: Uniben Contact
|
---|
58 |
|
---|
59 | Fullname: %(fullname)s
|
---|
60 | Member ID: %(regno)s
|
---|
61 | Problem Type: %(probtype)s
|
---|
62 | Description: %(descr)s
|
---|
63 | """
|
---|
64 |
|
---|
65 | #prop.email_from_address should be used for To:
|
---|
66 |
|
---|
67 | mhost.send(msg % d)
|
---|
68 |
|
---|
69 | REQUEST = context.REQUEST
|
---|
70 | RESPONSE = REQUEST.RESPONSE
|
---|
71 |
|
---|
72 | redirect_url = REQUEST.HTTP_REFERER
|
---|
73 | redirect_url = '%s/?%s' % (redirect_url,'portal_status_message=Your message has been sent!')
|
---|
74 | RESPONSE.redirect(redirect_url)
|
---|
Note: See
TracBrowser for help on using the repository browser.