title: How to download all attachments from outlook using python?
body: <p>Problem : </p>
  
  <p>In one mail i will be having multiple attachments and i need to download all.</p>
  
  <p>How can i do this?</p>
  
  <p>My code:</p>
  
  <pre><code>import win32com.client
  import os
  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
  messages = inbox.Items
  message = messages.GetFirst()
  subject = message.Subject
  #
  get_path = 'C:\\Users\\test\\Desktop\\resumes'
  
  for m in messages:
      if m.Subject == "FW: Opportunity with Mindtree | Automotive Infotainment |":
  
          print (message)
          attachments = message.Attachments
          attachment = attachments.Item(1)
          attachment.SaveASFile(os.path.join(get_path,attachment.FileName)) #Saves to the attachment to current folder
          print (attachment)
          message = messages.GetNext()
  
      else:
          message = messages.GetNext()
  </code></pre>