Skip to content

Instantly share code, notes, and snippets.

@goerz
Created August 31, 2009 09:01
Show Gist options
  • Save goerz/178368 to your computer and use it in GitHub Desktop.
Save goerz/178368 to your computer and use it in GitHub Desktop.
partCounter = 1
for part in msg.walk():
if part.get_main_type()=="multipart":
continue
name = part.get_param("name")
if name==None:
name = "part-%i" % partCounter
partCounter+=1
f = open(name,"wb")
f.write(part.get_payload(decode=1))
f.close()
print name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment