title: Read all emails from outlook
body: <p>I wanted to check how can I read all emails from outlook in python</p>
  
  <p>I am using below code, but this code is reading only first mail, </p>
  
  <pre><code>import win32com.client
  
  outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
  
  inbox = outlook.GetDefaultFolder(6) # "6" refers to the index of a folder - in this case,
                                      # the inbox. You can change that number to reference
                                      # any other folder
  messages = inbox.Items
  message = messages.GetLast()
  body_content = message.Body
  subject = message.Subject
  categories = message.Categories
  print(body_content)
  print(subject)
  print(categories)
  </code></pre>
  
  <p>I tried to find a way so that we can read all emails but unable to get a solution, is anyone know how we can read all emails and store in the database.</p>