In result, I've used the following solution:
if msg.is_multipart():
for part in msg.walk():
if part.get_content_type() and part.get_content_type()=='text/plain': # ignore text/html
charset = part.get_content_charset()
body = part.get_payload(decode=True).decode(charset)
else:
body = msg.get_payload(decode=True)
body = body.decode('utf-8')
and in order to display Russian text correctly in developer's admin console (under Windows 7):
def logging_debug(what):
''' Function to support cp866 encoding in developers admin console
'''
if os.environ.get('SERVER_SOFTWARE','').startswith('Devel'):
logging.debug(what.encode('cp866'))
else:
logging.debug(what)