def processMessage(self, m):
        """ walk through the parts of multiparts MIME messages
        """
        self.writelog("    - process mail : ", re.compile("=\?.*?Q\?").sub("", quopri.decodestring(m.get_all("Subject")[0])))
        for i in m.walk():
            if i.is_multipart():
                continue
            if i.get_content_maintype() == 'text':
                pl = i.get_payload(decode=False)
                continue
            att_name = i.get_filename(None)  # get the filename
            if not att_name:
                # This part is relative to an attached file without name
                ext = mimetypes.guess_extension(i.get_content_type())
                att_name = 'makeitup%s' % ext
                pl = i.get_payload(decode=False) # Get the content of this part of the message without decoding it
            else:
                # This part is relative to an attached file
                ext=att_name.split(".")[-1]
                if ext != "html": # we dont detach html files because our links will be contained in html files
                                  # So, if whe use this script more than once, we don't want to detach html links files
                    pl = i.get_payload(decode=True) # We get the content of this part of the message and decode it
                    date=self.getDate(m.get_all("Date")[0])
                    htmlcontent=self.detachFile(att_name, pl, date)
                    # We replace the header to mention this is an html file
                    i.set_type("text/html")
                    try:
                        i.replace_header("Content-Transfer-Encoding", "7bit")
                    except KeyError:
                        self.writelog("ERROR - Content-Transfer-Encoding")
                        traceback.print_exc(file=self.lf)
                    i.replace_header("Content-Disposition", 'inline; filename="%s.html"' % att_name)
                    i.del_param("name")
                    # We replace the original included file by the html file containing the links
                    i.set_payload(htmlcontent)
        return str(m)
 walk through the parts of multiparts MIME messages
        
recipes/Python/576749_Detach_Thunderbird_emails_keep/recipe-576749.py