Thanks for your suggestions! Here's what seems to be working - it's basically the same thing I originally had, but first checks to see if the line is blank
response, lines, bytes = M.retr(i+1) # For each line in message for line in lines: if not line.strip(): M.dele(i+1) break emailMessage = email.message_from_string(line) # Get fields fields = emailMessage.keys() # If email contains "From" field if emailMessage.has_key("From"): # Get contents of From field from_field = emailMessage.__getitem__("From") -- http://mail.python.org/mailman/listinfo/python-list