title: Python: Retrieving only POP3 message text, no headers
body: <p>I'm trying to make a Python program that retrieves only the body text of an email without passing headers or any other parameters. I'm not sure how to go about this.</p>
  
  <p>The goal is to be able to send basic commands to a program via message text.</p>
  
  <p>What I have now is this:</p>
  
  <pre><code>import poplib
  
  host = "pop.gmail.com"
  mail = poplib.POP3_SSL(host)
  print mail.getwelcome()
  print mail.user("user")
  print mail.pass_("pass")
  print mail.stat()
  print mail.list()
  print ""
  
  if mail.stat()[1] &gt; 0:
      print "You have new mail."
  else:
      print "No new mail."
  
  print ""
  
  numMessages = len(mail.list()[1])
  for i in range(numMessages):
      for j in mail.retr(i+1)[1]:
          print j
  
  mail.quit()
  input("Press any key to continue.")
  </code></pre>
  
  <p>Which is all fine, except when "print J" is executed it prints the entire message, including headers. I just want to extract the body text without any additional garbage.</p>
  
  <p>Can anyone help? Thanks!</p>