Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 16268)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 16299)
@@ -90,4 +90,5 @@
     def setUp(self):
         super(StudentsFullSetup, self).setUp()
+        self.setup_logging()
 
         # Setup a sample site for each test
@@ -252,4 +253,19 @@
 
     layer = FunctionalLayer
+
+    def setup_logging(self):
+        # setup a log-handler that catches all fake mailer output
+        self.stream = StringIO()
+        handler = logging.StreamHandler(self.stream)
+        logger = logging.getLogger('test.smtp')
+        logger.addHandler(handler)
+        logger.setLevel(logging.INFO)
+        return
+
+    def get_fake_smtp_output(self):
+        # get output generated by fake mailer
+        self.stream.flush()
+        self.stream.seek(0)
+        return self.stream.read()
 
     def test_anonymous_access(self):
@@ -432,4 +448,58 @@
         self.assertTrue('No student found' in self.browser.contents)
         return
+
+    def test_send_bulk_emails(self):
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.manage_container_path)
+        self.browser.getLink("Add student").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.url, self.add_student_path)
+        self.browser.getControl(name="form.firstname").value = 'Bob'
+        self.browser.getControl(name="form.lastname").value = 'Tester'
+        self.browser.getControl(name="form.reg_number").value = '1234'
+        self.browser.getControl("Create student").click()
+        self.assertTrue('Student record created' in self.browser.contents)
+        self.browser.getLink("Manage").click()
+        self.browser.getControl(name="form.email").value = 'uli@uni.ng'
+        self.browser.getControl(name="form.sex").value = ['m']
+        self.browser.getControl("Save").click()
+        # We can find Anna and Bob
+        self.browser.open(self.manage_container_path)
+        self.browser.getControl(name="searchtype").value = ['student_id']
+        self.browser.getControl(name="searchterm").value = '*'
+        self.browser.getControl("Find student(s)").click()
+        self.assertTrue('Anna Tester' in self.browser.contents)
+        self.assertTrue('Bob Tester' in self.browser.contents)
+        # We can send bulk emails
+        ctrl = self.browser.getControl(name='entries')
+        ctrl.getControl(value='K1000000').selected = True
+        ctrl.getControl(value='K1000001').selected = True
+        self.browser.getControl("Send bulk", index=0).click()
+        self.assertTrue('K1000000 &lt;aa@aa.ng&gt;,K1000001 &lt;uli@uni.ng&gt;'
+            in self.browser.contents)
+        self.browser.getControl(name="form.subject").value = 'Test'
+        self.browser.getControl(name="form.body").value = 'Hello world'
+        self.browser.getControl("Send message").click()
+        self.assertTrue('Your message has been sent' in self.browser.contents)
+        self.assertMatches(
+        u'Sending email from no-reply@waeup.org to contact@waeup.org:\n'
+        u'Message:\n'
+        u'msg: MIME-Version: 1.0\n'
+        u'msg: Content-Type: text/plain; charset="us-ascii"\n'
+        u'msg: Content-Transfer-Encoding: 7bit\n'
+        u'msg: From: Manager <no-reply@waeup.org>\n'
+        u'msg: To: Manager <contact@waeup.org>\n'
+        u'msg: Bcc: K1000000 <aa@aa.ng>,K1000001 <uli@uni.ng>\n'
+        u'msg: Reply-To: Manager <contact@waeup.org>\n'
+        u'msg: Subject: Test\n'
+        u'msg: \n'
+        u'msg: Hello world\n'
+        u'msg: \n'
+        u'msg: ---\n'
+        u'msg: Manager (id: zope.mgr)\n'
+        u'msg: Sample University\n'
+        u'msg: \n',
+            self.get_fake_smtp_output()
+            )
 
     def test_add_graduated_students(self):
