title: Download attachment from Outlook using Python
body: <p>I am trying to download attachments from Outlook using Python, as of now am able to download the attachments by subject line but in my case I want to download multiple attachments from multiple emails where subject line starts with some string, For Ex:
  Subjects are: Query 123654, Query 56975, Query 5698 like this and I want to download all of them where subject name starts with "Query".
  My current code is below:</p>
  
  <pre><code>from win32com.client import Dispatch
  outlook = Dispatch("Outlook.Application").GetNamespace("MAPI")
  inbox = outlook.GetDefaultFolder("6")
  all_inbox = inbox.Items
  val_date = datetime.date.today()
  
  sub_today = 'Query 123654'
  att_today = ''
  for msg in all_inbox:
      if msg.Subject == sub_today and msg.Senton.date() == val_date:
          break
  
  for att in msg.Attachments:
      if att.FileName == att_today:
          break
  
  try:
      att.SaveAsFile('C:\\Offline Feeds\\Attachments' + '\\'+ att.FileName)
      messagebox.showinfo("SUCCESSFUL","Attachments Downloaded")
  except:
      messagebox.showerror("ERROR","Attachment Download Failed")
  </code></pre>