def create_html_mailto(<EOL>email,<EOL>subject=None,<EOL>body=None,<EOL>cc=None,<EOL>bcc=None,<EOL>link_label="<STR_LIT>",<EOL>linkattrd=None,<EOL>escape_urlargd=True,<EOL>escape_linkattrd=True,<EOL>email_obfuscation_mode=None):
<EOL>if email_obfuscation_mode is None:<EOL><INDENT>email_obfuscation_mode = cfg.get(<EOL>'<STR_LIT>')<EOL><DEDENT>if linkattrd is None:<EOL><INDENT>linkattrd = {}<EOL><DEDENT>parameters = {}<EOL>if subject:<EOL><INDENT>parameters["<STR_LIT>"] = subject<EOL><DEDENT>if body:<EOL><INDENT>parameters["<STR_LIT:body>"] = body.replace('<STR_LIT:\r\n>', '<STR_LIT:\n>').replace('<STR_LIT:\n>', '<STR_LIT:\r\n>')<EOL><DEDENT>if cc:<EOL><INDENT>parameters["<STR_LIT>"] = cc<EOL><DEDENT>if bcc:<EOL><INDENT>parameters["<STR_LIT>"] = bcc<EOL><DEDENT>if email_obfuscation_mode == <NUM_LIT:1>:<EOL><INDENT>email = email.replace("<STR_LIT:@>", "<STR_LIT>").replace("<STR_LIT:.>", "<STR_LIT>")<EOL><DEDENT>elif email_obfuscation_mode == <NUM_LIT:2>:<EOL><INDENT>email = string_to_numeric_char_reference(email)<EOL><DEDENT>if '<STR_LIT>' in link_label:<EOL><INDENT>link_label = link_label % {'<STR_LIT:email>': email}<EOL><DEDENT>mailto_link = create_html_link('<STR_LIT>' + email, parameters,<EOL>link_label, linkattrd,<EOL>escape_urlargd, escape_linkattrd)<EOL>if email_obfuscation_mode == <NUM_LIT:0>:<EOL><INDENT>return mailto_link<EOL><DEDENT>elif email_obfuscation_mode == <NUM_LIT:1>:<EOL><INDENT>return mailto_link<EOL><DEDENT>elif email_obfuscation_mode == <NUM_LIT:2>:<EOL><INDENT>return mailto_link<EOL><DEDENT>elif email_obfuscation_mode == <NUM_LIT:3>:<EOL><INDENT>return '''<STR_LIT>''''''<STR_LIT>''''''<STR_LIT>''''''<STR_LIT>''' %mailto_link[::-<NUM_LIT:1>].replace("<STR_LIT:'>", "<STR_LIT>")<EOL><DEDENT>elif email_obfuscation_mode == <NUM_LIT:4>:<EOL><INDENT>email = email.replace(<EOL>'<STR_LIT:.>', '<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>cfg.get('<STR_LIT>'))<EOL>email = email.replace(<EOL>'<STR_LIT:@>', '<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>cfg.get('<STR_LIT>'))<EOL>return email<EOL><DEDENT>return "<STR_LIT>"<EOL>
Creates a W3C compliant 'mailto' link.

    Encode/encrypt given email to reduce undesired automated email
    harvesting when embedded in a web page.

    NOTE: there is no ultimate solution to protect against email
    harvesting. All have drawbacks and can more or less be
    circumvented. There are other techniques to protect email
    addresses. We implement the less annoying one for users.

    @param email: the recipient of the email
    @param subject: a default subject for the email (must not contain
                    line feeds)
    @param body: a default body for the email
    @param cc: the co-recipient(s) of the email
    @param bcc: the hidden co-recpient(s) of the email
    @param link_label: the label of this mailto link. String
                       replacement is performed on key %(email)s with
                       the email address if needed.
    @param linkattrd: dictionary of attributes (e.g. a={'class': 'img'})
    @param escape_urlargd: boolean indicating if the function should escape
                           arguments (e.g. < becomes &lt; or " becomes &quot;)
    @param escape_linkattrd: boolean indicating if the function should escape
                           attributes (e.g. < becomes &lt; or " becomes &quot;)
    @param email_obfuscation_mode: the protection mode. See below:

    You can choose among several modes to protect emails. It is
    advised to keep the default
    CFG_MISCUTIL_EMAIL_HARVESTING_PROTECTION value, so that it is
    possible for an admin to change the policy globally.

    Available modes ([t] means "transparent" for the user):

         -1: hide all emails, excepted CFG_SITE_ADMIN_EMAIL and
             CFG_SITE_SUPPORT_EMAIL.

      [t] 0 : no protection, email returned as is.
                foo@example.com => foo@example.com

          1 : basic email munging: replaces @ by [at] and . by [dot]
                foo@example.com => foo [at] example [dot] com

      [t] 2 : transparent name mangling: characters are replaced by
              equivalent HTML entities.
                foo@example.com => &#102;&#111;&#111;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;

      [t] 3 : javascript insertion. Requires Javascript enabled on client side.

          4 : replaces @ and . characters by gif equivalents.
                foo@example.com => foo<img src="at.gif" alt=" [at] ">example<img src="dot.gif" alt=" [dot] ">com