Index: main/waeup.sirp/branches/henrik-contactforms/src/waeup/sirp/browser/pages.py
===================================================================
--- main/waeup.sirp/branches/henrik-contactforms/src/waeup/sirp/browser/pages.py	(revision 5425)
+++ main/waeup.sirp/branches/henrik-contactforms/src/waeup/sirp/browser/pages.py	(revision 5426)
@@ -8,4 +8,8 @@
 import re
 import sys
+import time
+import re
+import smtplib
+from email.mime.text import MIMEText
 from hurry import yui
 from hurry.workflow.interfaces import NoTransitionAvailableError
@@ -313,4 +317,35 @@
             tt = u'Enquiries'         
         return tt     
+        
+    def update(self, *args, **kw):
+        form = self.request.form
+        if not ('fullname' in form and 'email' in form and 'descr' in form):
+            return
+        self.fullname = fullname = form['fullname']
+        email = form['email']
+        self.descr = descr = form['descr']
+        regno =form['regno']
+        if not (fullname and email and descr):
+            self.flash('Error: All fields must be filled!')
+            return        
+        if not re.match("^[a-zA-Z0-9._%-]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", email):
+            self.flash('Error: %s is not a valid email address!' % email)
+            return
+        if regno == 'zope.anybody':
+            regno = 'Anonymous User'
+        text = """Fullname: %s
+Member ID: %s
+Description: %s
+"""
+        msg = MIMEText(text % (fullname,regno,descr))
+        msg['From'] = '%s <%s>' % (fullname,email)
+        msg['To'] = 'henrik@waeup.org'
+        msg['Subject'] = 'WAeUP Contact'
+        server = smtplib.SMTP('smtp.scientific-african.org')
+        server.login('henrik@scientific-african.org','kwamekofi')
+        server.sendmail(email,'henrik@waeup.org',msg.as_string())
+        server.quit()
+        self.flash('Your message has been sent.')
+        return 
 
 #
Index: main/waeup.sirp/branches/henrik-contactforms/src/waeup/sirp/browser/templates/contactadminform.pt
===================================================================
--- main/waeup.sirp/branches/henrik-contactforms/src/waeup/sirp/browser/templates/contactadminform.pt	(revision 5425)
+++ main/waeup.sirp/branches/henrik-contactforms/src/waeup/sirp/browser/templates/contactadminform.pt	(revision 5426)
@@ -1,3 +1,3 @@
-<form id="form1" name="form1" method="post" action="mail2admin">
+<form id="form1" name="form1" method="post">
 <input type="hidden" name="regno" type="text" id="regno"
      tal:attributes="value layout/getUserId"/>
@@ -8,8 +8,10 @@
   </td>
   <td tal:condition="not:layout/isAuthenticated">
-     <input name="fullname" type="text" id="fullname" />
+     <input name="fullname" type="text" id="fullname" tal:attributes="value view/fullname|nothing" />
   </td>
-  <td tal:condition="layout/isAuthenticated" tal:content="layout/getUserTitle">
-      User Name
+  <td tal:condition="layout/isAuthenticated"> 
+    <span tal:content="layout/getUserTitle" />
+    <input type="hidden" name="fullname" type="text" id="fullname"
+       tal:attributes="value layout/getUserTitle"/>
   </td>  
 </tr>
@@ -27,5 +29,6 @@
   </td>
   <td>
-     <textarea name="descr" rows="10" cols="60" id="descr"></textarea>
+     <textarea name="descr" rows="10" cols="60" id="descr"><span tal:replace="view/descr|nothing" /></textarea>
+     
   </td>
 </tr>
