title: How do I send emails to multiple people on outlook in python?
body: <p>Stuck in a small problem for 2 days. I am trying to send multiple emails using my outlook to multiple people. Here is what I am trying to do: </p>
  
  <ol>
  <li>Break an excel file into multiple files basis company names  </li>
  <li>Attach that excel on an email and send. The email is getting picked from a master list of email ids stored in an excel. </li>
  </ol>
  
  <p><strong>Problem:</strong> 
  I am getting the below error code while running the program. I am able to break the large excel into multiple smaller ones, but only the first excel gets mailed and then I get this error message.</p>
  
  <p>(-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', 'The item has been moved or deleted.', None, 0, -2147221238), None)</p>
  
  <pre><code>#code
  
  import win32com.client as win32
  outlook = win32.Dispatch('outlook.application')
  mail = outlook.CreateItem(0)
  
  
  file_path = r'C:\Users\ABC\Documents\Email\Email.xlsx'
  df1 = pd.read_excel(file_path, sheet_name = 'Master excel')
  df2 = pd.read_excel(file_path, sheet_name = 'Email list')
  
  df11 = df1['Co name'].unique()
  list_carrier = list(df11)
  
  path = r'C:\Users\ABC\Documents\Python\Email\np\\'
  for i in list_carrier:
      dfa = df1[df1['Co Name']==i]
      wb = Workbook()
      path_1=path+i+".xlsx"
      writer = pd.ExcelWriter(path_1, engine='openpyxl', mode='W')
      writer.wb = wb
      dfa.to_excel(writer, sheet_name="sheet1")
      writer.save()
  
  for i in list_carrier:
  
      email = df2.loc[df2['Co Name'] == i, 'Email'].item()
      mail.cc = 'abc@gmail.com; xyz@gmail.com'
      mail.To = email
      mail.Subject = f" {i} - File for testing"
      mail.Body = """\
      Hi, 
  
      sending test mail.
  
      Regards, """
  
      path_1=path+i+".xlsx"
      mail.Attachments.Add(path_1)
      mail.Send()
  </code></pre>