import email

fp = open("threeluan.eml", "r")
msg = email.message_from_file(fp) # ??????message??,????????????
subject = msg.get("subject") # ??????subject, ?????
# ??????????????=?gbk?Q?=CF=E0=C6=AC?=???subject
h = email.Header.Header(subject)
dh = email.Header.decode_header(h)
subject = dh[0][0]
print "subject:", subject
print "from: ", email.utils.parseaddr(msg.get("from"))[1] # ?from
print "to: ", email.utils.parseaddr(msg.get("to"))[1] # ?to

fp.close()
adf5b942be4cafbfec5f6658ccb1e4a36151546c
import email

fp = open("threeluan.eml", "r")
msg = email.message_from_file(fp) # ??????message??,????????????
subject = msg.get("subject") # ??????subject, ?????
# ??????????????=?gbk?Q?=CF=E0=C6=AC?=???subject
h = email.Header.Header(subject)
dh = email.Header.decode_header(h)
subject = dh[0][0]
print "subject:", subject
print "from: ", email.utils.parseaddr(msg.get("from"))[1] # ?from
print "to: ", email.utils.parseaddr(msg.get("to"))[1] # ?to

fp.close()