source: WAeUP_SRP/trunk/skins/waeup_uniben/mail2admin.py @ 5598

Last change on this file since 5598 was 5565, checked in by Henrik Bettermann, 14 years ago

Catch traceback (SMTPSenderRefused)

File size: 1.2 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 2334 2007-10-09 15:01:36Z henrik $
11
12mhost = context.MailHost
13prop = context.portal_properties
14
15d = {}
16d['fullname'] = fullname
17d['email'] = email
18d['email_from'] = prop.email_from_address
19d['regno'] = regno
20d['probtype'] = probtype
21d['descr'] = descr
22
23message = """
24From: %(fullname)s <%(email)s>
25To: %(email_from)s
26Cc: %(email)s
27Bcc: waeup@saoas.org
28Reply-To: %(email)s
29Subject: Uniben Contact
30
31Fullname: %(fullname)s
32Member ID: %(regno)s
33Problem Type: %(probtype)s
34Description: %(descr)s
35"""
36
37REQUEST = context.REQUEST
38RESPONSE = REQUEST.RESPONSE
39redirect_url = REQUEST.HTTP_REFERER
40
41
42try:
43    mhost.send(message % d)
44    redirect_url = '%s/?%s' % (redirect_url,'portal_status_message=Your message has been sent!')
45except:
46    redirect_url = '%s/?%s' % (redirect_url,'portal_status_message=An error occurred, your message has not been sent!')
47
48RESPONSE.redirect(redirect_url)
Note: See TracBrowser for help on using the repository browser.