    def mailAccountData(self, cleartext_passwd=None, invitation=False):
        from MoinMoin.mail import sendmail
        from MoinMoin.wikiutil import getSysPage
        _ = self._request.getText

        if not self.enc_password: # generate pw if there is none yet
            from random import randint
            import base64

            charset = 'utf-8'
            pwd = "%s%d" % (str(time.time()), randint(0, 65535))
            pwd = pwd.encode(charset)

            pwd = sha.new(pwd).digest()
            pwd = '{SHA}%s' % base64.encodestring(pwd).rstrip()

            self.enc_password = pwd
            self.save()

        if not invitation:
            text = '\n' + _("""\
Login Name: %s

Login Password: %s

Login URL: %s/%s?action=login
""", formatted=False) % (
                        self.name, self.enc_password, self._request.getBaseURL(), getSysPage(self._request, 'UserPreferences').page_name)

            text = _("""\
Somebody has requested to submit your account data to this email address.

If you lost your password, please use the data below and just enter the
password AS SHOWN into the wiki's password form field (use copy and paste
for that).

After successfully logging in, it is of course a good idea to set a new and known password.
""", formatted=False) + text

        else:
            text = '\n' + _("""\
Login Name: %s

Login Password: %s

Login URL: %s/%s?action=login
""", formatted=False) % (
                        self.name, cleartext_passwd, self._request.getBaseURL(), getSysPage(self._request, 'UserPreferences').page_name)

            text = _("""\
Welcome to the %(sitename)s Wiki!

You are invited to join our wiki community and share your ideas with us.
Please use the login name and password below to log in. To ease login, you can
also use copy and paste.
Please do also make sure that in your browser's settings cookies are enabled
for the login url so that authentications does really work and is kept while
navigating in the wiki.

After successfully logging in, it is of course a good idea to set a new password
of your choice.
""", formatted=False) % {'sitename': self._cfg.sitename or "Wiki"}  + text


        subject = _('[%(sitename)s] Your wiki account data',
                    formatted=False) % {'sitename': self._cfg.sitename or "Wiki"}
        mailok, msg = sendmail.sendmail(self._request, [self.email], subject,
                                    text, mail_from=self._cfg.mail_from)
        return msg
