Skip to content

Instantly share code, notes, and snippets.

View spapas's full-sized avatar

Serafeim Papastefanos spapas

View GitHub Profile
@spapas
spapas / get_attachments.py
Created December 22, 2014 18:37
Extract attachments from text mail messages
import email
import sys
if __name__=='__main__':
if len(sys.argv)<2:
print "Please enter a file to extract attachments from"
sys.exit(1)
msg = email.message_from_file(open(sys.argv[1]))
for pl in msg.get_payload():