diff --git a/dim b/dim
index b8a9689027b62be59727ae52612f27862e86d2e0..18a0f360a2fba29c7dfdfb57311a1ebdbf790d96 100755
--- a/dim
+++ b/dim
@@ -432,18 +432,11 @@ message_print_body ()
 	python2 <<EOF
 import email
 
-def print_part(part):
-    mtype = part.get_content_maintype()
-    if mtype == 'text':
-        print(part.get_payload(decode=True))
-
 def print_msg(file):
     msg = email.message_from_file(file)
-    if msg.is_multipart():
-        for part in msg.get_payload():
-            print_part(part)
-    else:
-        print_part(msg)
+    for part in msg.walk():
+        if part.get_content_type() == 'text/plain':
+            print(part.get_payload(decode=True))
 
 print_msg(open('$1', 'r'))
 EOF