public function parse(array $tag, $content) {
        if (empty($tag['attributes']['default'])) {
            $email = $content;
            $default = false;
        } else {
            $email = $tag['attributes']['default'];
            $default = true;
        }

        // Return an invalid email
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            return $content;
        }

        $encrypted = '';

        if ($this->getConfig('encrypt')) {
            $length = mb_strlen($email);

            if ($length > 0) {
                for ($i = 0; $i < $length; ++$i) {
                    $encrypted .= '&#' . ord(mb_substr($email, $i, 1)) . ';';
                }
            }
        } else {
            $encrypted = $email;
        }

        $tag['attributes']['href'] = 'mailto:' . $encrypted;

        if ($this->getParser()->getConfig('shorthandLinks')) {
            $tag['content'] = $this->message('mail');

            return '[' . parent::parse($tag, $content) . ']';
        }

        if (!$default) {
            $tag['content'] = $encrypted;
        }

        return parent::parse($tag, $content);
    }