Index: /main/waeup.kofa/trunk/CHANGES.txt
===================================================================
--- /main/waeup.kofa/trunk/CHANGES.txt	(revision 16550)
+++ /main/waeup.kofa/trunk/CHANGES.txt	(revision 16551)
@@ -4,4 +4,6 @@
 1.7.2.dev0 (unreleased)
 =======================
+
+* Send email to student after single record creation.
 
 * Forward credentials to login page after password reset request.
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py	(revision 16550)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py	(revision 16551)
@@ -22,4 +22,5 @@
 from hurry.query import Eq, Text
 from hurry.query.query import Query
+from urllib import urlencode
 from zope.component import getUtility, createObject, getAdapter
 from zope.component.interfaces import IFactory
@@ -171,7 +172,7 @@
         return
 
-    def createStudent(self, view=None, graduated=False):
+    def createStudent(self, view=None, graduated=False, send_email=False):
         """Create a student, fill with base data, create an application slip,
-        copy applicant data and files.
+        copy applicant data and files, send an email (optional).
         """
         site = grok.getSite()
@@ -266,4 +267,12 @@
             view=view)
         self._saveApplicationPDF(student, applicant_slip, view=view)
+        if view and send_email:
+            kofa_utils = getUtility(IKofaUtils)
+            pw = self.application_number
+            args = {'login':student.student_id, 'password':pw}
+            login_url = view.url(grok.getSite()) + '/login?%s' % urlencode(args)
+            rpw_url = view.url(grok.getSite(), 'changepw')
+            kofa_utils.informNewStudent(
+                IUserAccount(student), pw, login_url, rpw_url)
         return True, _('Student ${a} created', mapping = {'a':student.student_id})
 
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py	(revision 16550)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py	(revision 16551)
@@ -730,5 +730,5 @@
 
     def update(self):
-        success, msg = self.context.createStudent(view=self)
+        success, msg = self.context.createStudent(view=self, send_email=True)
         if success:
             self.flash(msg)
Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 16550)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 16551)
@@ -1411,4 +1411,47 @@
         return
 
+    def test_create_student(self):
+        # Managers can contact student
+        IWorkflowState(self.applicant).setState('admitted')
+        self.applicant.certificate = self.certificate
+        self.applicant.course_admitted = self.certificate
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.manage_path)
+        self.fill_correct_values() 
+        image = open(SAMPLE_IMAGE, 'rb')
+        ctrl = self.browser.getControl(name='form.passport')
+        file_ctrl = ctrl.mech_control
+        file_ctrl.add_file(image, filename='myphoto.jpg')
+        self.browser.getControl("Save").click()
+        self.browser.open(self.view_path)
+        self.browser.getLink("Create student").click()
+        self.assertTrue('Student K1000000 created' in self.browser.contents)
+        self.assertMatches(
+            'Sending email from no-reply@waeup.org to xx@yy.zz:'
+            '\nMessage:'
+            '\nmsg: MIME-Version: 1.0'
+            '\nmsg: Content-Type: text/plain; charset="us-ascii"'
+            '\nmsg: Content-Transfer-Encoding: 7bit'
+            '\nmsg: From: Administrator <no-reply@waeup.org>'
+            '\nmsg: To: John Anthony Tester <xx@yy.zz>'
+            '\nmsg: Reply-To: Administrator <contact@waeup.org>'
+            '\nmsg: Subject: Your new Kofa student account'
+            '\nmsg:'
+            '\nmsg: Dear John Anthony Tester,'
+            '\nmsg:'
+            '\nmsg: Your student record of the Student Registration and Information Portal of'
+            '\nmsg: Sample University has been created for you.'
+            '\nmsg:'
+            '\nmsg: Your user name: K1000000'
+            '\nmsg: Your password: %s'
+            '\nmsg: Login: http://localhost/app/login?login=K1000000&password=%s'
+            '\nmsg:'
+            '\nmsg: Or request a new secure password here: http://localhost/app/changepw'
+            '\nmsg:'
+            '\nmsg: Regards'
+            '\nmsg:' % (self.applicant.application_number, self.applicant.application_number),
+            self.get_fake_smtp_output()
+            )
+        return
 
 class ApplicantRegisterTests(ApplicantsFullSetup):
Index: /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py	(revision 16550)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py	(revision 16551)
@@ -359,4 +359,42 @@
             subject, body, config)
 
+    def informNewStudent(self, user, pw, login_url, rpw_url):
+        """Inform student that a new student account has been created.
+        """
+        subject = 'Your new Kofa student account'
+        text = _(u"""Dear ${a},
+
+Your student record of the Student Registration and Information Portal of
+${b} has been created for you.
+
+Your user name: ${c}
+Your password: ${d}
+Login: ${e}
+
+Or request a new secure password here: ${f}
+
+Regards
+""")
+        config = grok.getSite()['configuration']
+        from_name = config.name_admin
+        from_addr = config.email_admin
+        rcpt_name = user.title
+        rcpt_addr = user.email
+
+        text = _(text, mapping={
+            'a': rcpt_name,
+            'b': config.name,
+            'c': user.name,
+            'd': pw,
+            'e': login_url,
+            'f': rpw_url
+            })
+        body = translate(text, 'waeup.kofa',
+            target_language=self.PORTAL_LANGUAGE)
+        return send_mail(
+            from_name, from_addr, rcpt_name, rcpt_addr,
+            subject, body, config)
+
+
     def inviteReferee(self, referee, applicant, url_info=None):
         """Send invitation email to referee.
