title: Get sender email address with Python IMAP
body: <p>I have this python IMAP script, but my problem is that, every time I want to get the sender's email address, (From), I always get the sender's first name followed by their email address:</p>
  
  <p>Example:</p>
  
  <pre><code>Souleiman Benhida &lt;souleb@gmail.com&gt;
  </code></pre>
  
  <p>How can i just extract the email address (<code>souleb@gmail.com</code>)</p>
  
  <p>I did this before, in PHP:</p>
  
  <pre><code>    $headerinfo = imap_headerinfo($connection, $count)
      or die("Couldn't get header for message " . $count . " : " . imap_last_error());
  $from = $headerinfo-&gt;fromaddress;
  </code></pre>
  
  <p>But, in python I can only get the full name w/address, how can I get the address alone? I currently use this:</p>
  
  <pre><code>    typ, data = M.fetch(num, '(RFC822)')
  mail = email.message_from_string(data[0][1])
  headers = HeaderParser().parsestr(data[0][1]) 
  message = parse_message(mail)  #body
  org = headers['From']
  </code></pre>
  
  <p>Thanks!</p>