title: How to send Email from secondary Account in Outlook and Python
body: <p>I have access to a second email account and I want to send automated emails with this email. I already tried <a href="https://stackoverflow.com/questions/30243518/send-email-from-specific-outlook-account-via-python">THIS</a> and <a href="https://stackoverflow.com/questions/35908212/python-win32com-outlook-2013-sendusingaccount-return-exception">THIS</a> but it still sends mails with my primary account and not with the second one. I am using python with outlook.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import os
  import csv
  
  def Emailer(message, subject, recipient, anrede, name):
      import win32com.client as win32   
  
      outlook = win32.Dispatch('outlook.application')
      mail = outlook.CreateItem(0)
      mail.To = recipient
      mail.Subject = subject
      mail.GetInspector 
  
      header = 'MyHeader'
      message = 'MyHTMLMessage'
  
      index = mail.HTMLbody.find('&gt;', mail.HTMLbody.find('&lt;body')) 
      mail.HTMLbody = "&lt;font size=-1 face='Arial'&gt;" + mail.HTMLbody[:index + 1] + header + message + mail.HTMLbody[index + 1:] 
  
      mail.send
  
  
  with open('Komplette Liste.csv', 'rb') as csvfile:
  reader = csv.reader(csvfile, delimiter=';')
  csv_list = list(reader)
  
  row_count = sum(1 for row in csv_list)
  
  for i in range(1,row_count):    
              unternehmen = str(csv_list[i][0])
              mail_address = str(csv_list[i][7])
              name = str(csv_list[i][8])
  
              infomail_count = infomail_count + 1 
              print(mail_address)
  
              Emailer("", "My Subject", "MailTo")
  </code></pre>
  
  <p>I would appreciate your help!                     </p>