title: how to find the sender email id using python
body: <pre class="lang-py prettyprint-override"><code>import imaplib
  
  def read():
      username = "xxx@gmail.com"
      password = 'xxx'
      data = []
      imap = imaplib.IMAP4_SSL("imap.gmail.com", 993)
      imap.login(username, password)
      imap.select('INBOX')
      # Print all unread messages from a certain sender of interest
      status, response = imap.status('INBOX', "(UNSEEN)")
      unread_msg_nums = response[0].split()
      for e_id in unread_msg_nums:
          _, response = imap.fetch(e_id, '(UID BODY[TEXT])')
          data.append(response[0][1])
  
      for e_id in unread_msg_nums:
          imap.store(e_id, '+FLAGS', '\Seen')    
  read()
  </code></pre>
  
  <p>Here my requirement is planing to get all emails which are unread and find the all the sender email addresses after that make the mail as read.Above code has errors.
  How to do this in python.</p>