Message Parsing : Email : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » Email »

 

Message Parsing


import sys, email

msg = email.message_from_file(sys.stdin)
print " *** Headers in message: "
for header, value in msg.items():
    print header + ":"
    print "  " + value

if msg.is_multipart():
    print "exiting."
    sys.exit(1)

if 'subject' in msg:
    print "Subject: ", msg['subject']
print msg.get_payload()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» Email