#!/usr/local/bin/python
import sys
import email
full_msg = “”
for line in sys.stdin
full_msg += line
msg = email.message_from_string(full_msg)
to = msg[‘to’]
fromwho = msg[‘from’]
subject = msg[‘subject’]
#make an emty variable for email body
body = “”
#if the message contains attaachments find the body attachment
#if not find the entire emial body
if msg.is_multipart():
for payload in msg.get_payload():
# if payload.is_multipart(): …
body = payload.get_payload()
else:
body = msg.get_payload()





