def OnActionStart(self, event): handler = rt.RichTextHTMLHandler() handler.SetFlags(rt.RICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64) handler.SetFontSizeMapping([7,9,11,12,14,22,100]) import cStringIO stream = cStringIO.StringIO() if not handler.SaveStream(self.richTextPanel.rtc.GetBuffer(), stream): return htmldata = stream.getvalue() text = content.mime_message(htmldata, "hello hello this is a test", "this is a test", "*****@*****.**", "*****@*****.**").as_string() with open('email-example.eml', 'w') as f: f.write(text) #start send listctrl = self.list_ctrl _count = listctrl.GetItemCount() _host = config.read_config(config.HOST) _port = config.read_config(config.PORT) _user = config.read_config(config.ACCOUNT_NAME) _password = config.read_config(config.PASSWORD) _from = config.read_config(config.FROM) sender = Sender(_host, _port) sender.login(_user, _password) for i in range(_count): sender.send(_from, listctrl.GetItem(i, 1).GetText(), text)