password_email and registered_email
-----------------------------------

  First we have to set up some site properties::

    >>> from zope.component import getSiteManager
    >>> from zope.component import getUtility
    >>> from zope.component.hooks import setSite
    >>> from zope.globalrequest import setRequest
    >>> from Products.CMFCore.interfaces import IRegistrationTool
    >>> setSite(app.site)
    >>> setRequest(app.REQUEST)
    >>> sm = getSiteManager()
    >>> rtool = sm.getUtility(IRegistrationTool)

    >>> s = app.site
    >>> s.REQUEST.environ['HTTP_X_FORWARDED_FOR'] = 'NNN.NNN.NNN.NNN'
    >>> s.ZopeTime = 'NNNN/NN/NN'
    >>> s.description = 'THE SITE DESCRIPTION.'
    >>> s.default_charset = 'utf-8'
    >>> s.email_from_name = u'WEBMASTER \xc4\xd6\xdc'.encode('utf-8')
    >>> s.email_from_address = 'WEBMASTER@EXAMPLE.ORG'
    >>> s.title = 'WWW.EXAMPLE.ORG'

  password_email creates a complete reminder email::

    >>> s.email_charset = 'iso-8859-1'
    >>> print rtool.__of__(s).unrestrictedTraverse('password_email')()
    Content-Type: text/plain; charset="us-ascii"
    MIME-Version: 1.0
    Content-Transfer-Encoding: 7bit
    To: <foo@example.org>
    From: WEBMASTER =?iso-8859-1?q?=C4=D6=DC?= <WEBMASTER@EXAMPLE.ORG>
    Subject: [[cmf_default][WWW.EXAMPLE.ORG: Membership reminder]]
    <BLANKLINE>
    [[cmf_default][Your password: secret]]
    <BLANKLINE>
    [[cmf_default][Request made by IP NNN.NNN.NNN.NNN at NNNN/NN/NN]]
    <BLANKLINE>
    <BLANKLINE>

    >>> s.email_charset = ''
    >>> print rtool.__of__(s).unrestrictedTraverse('password_email')()
    Content-Type: text/plain; charset="us-ascii"
    MIME-Version: 1.0
    Content-Transfer-Encoding: 7bit
    To: <foo@example.org>
    From: WEBMASTER =?utf-8?...?= <WEBMASTER@EXAMPLE.ORG>
    Subject: [[cmf_default][WWW.EXAMPLE.ORG: Membership reminder]]
    <BLANKLINE>
    [[cmf_default][Your password: secret]]
    <BLANKLINE>
    [[cmf_default][Request made by IP NNN.NNN.NNN.NNN at NNNN/NN/NN]]
    <BLANKLINE>
    <BLANKLINE>

  registered_email creates a complete welcome email::

    >>> s.email_charset = 'iso-8859-1'
    >>> print rtool.__of__(s).unrestrictedTraverse('registered_email')()
    Content-Type: text/plain; charset="iso-8859-1"
    MIME-Version: 1.0
    Content-Transfer-Encoding: quoted-printable
    To: <foo@example.org>
    From: WEBMASTER =?iso-8859-1?q?=C4=D6=DC?= <WEBMASTER@EXAMPLE.ORG>
    Subject: [[cmf_default][WWW.EXAMPLE.ORG: Your Membership Information]]
    <BLANKLINE>
    [[cmf_default][You have been registered as a member of ...]]
    <BLANKLINE>
    [[cmf_default][This describes the purpose of the website:]]
    <BLANKLINE>
    THE SITE DESCRIPTION.
    <BLANKLINE>
    [[cmf_default][Visit us at http://nohost/site]]
    <BLANKLINE>
    [[cmf_default][Here is your login data (mind upper and lower case):]]
    <BLANKLINE>
    [[cmf_default][Member ID]]: foo
    [[cmf_default][Password]]: secret
    <BLANKLINE>
    [[cmf_default][You can use this URL to log in:]]
    <BLANKLINE>
    http://nohost/site/login_form
    <BLANKLINE>
    <BLANKLINE>
    WEBMASTER =C4=D6=DC
    <BLANKLINE>
    <BLANKLINE>

    >>> s.email_charset = ''
    >>> print rtool.__of__(s).unrestrictedTraverse('registered_email')()
    Content-Type: text/plain; charset="utf-8"
    MIME-Version: 1.0
    Content-Transfer-Encoding: ...
    To: <foo@example.org>
    From: WEBMASTER =?utf-8?...?= <WEBMASTER@EXAMPLE.ORG>
    Subject: [[cmf_default][WWW.EXAMPLE.ORG: Your Membership Information]]
    <BLANKLINE>
    ...
    <BLANKLINE>

Clean up
--------

    >>> from zope.globalrequest import clearRequest
    >>> clearRequest()
