title: Send table in pywin32 outlook email
body: <p>I use something like the following code to send emails automatically in Python. </p>
  
  <p>How do I make the table look like it was copied from excel into the email (i.e. table formatting)? Currently it treats the html formatted table as text within the body of the email, which is pretty useless.</p>
  
  <pre><code>import win32com.client
  import pandas as pd
  
  #Parameters
  data= [{'A' : 'data', 'B': 2, 'C':1.78},
        {'A' : 'data', 'B': 22, 'C':1.56},]
  table = pd.DataFrame(data)
  
  subject = 'email subject'
  body = '&lt;html&gt;&lt;body&gt;' + table.to_html() + '&lt;/body&gt;&lt;/html&gt;'
  recipient = 'email@domain.com'
  attachments = []
  
  #Create and send email
  olMailItem = 0x0
  obj = win32com.client.Dispatch("Outlook.Application")
  newMail = obj.CreateItem(olMailItem)
  newMail.Subject = subject
  newMail.Body = body
  newMail.To = recipient
  
  for location in attachments:
      newMail.Attachments.Add(Source=location)
  
  newMail.display()
  newMail.Send()
  </code></pre>
  
  <p>Sends an email that looks like this when I want it to be an actual table:</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;&lt;table border="1" class="dataframe"&gt; 
    &lt;thead&gt; 
      &lt;tr style="text-align: left;"&gt; 
        &lt;th&gt;A&lt;/th&gt; 
        &lt;th&gt;B&lt;/th&gt; 
        &lt;th&gt;C&lt;/th&gt; 
      &lt;/tr&gt; 
    &lt;/thead&gt; 
    &lt;tbody&gt; 
      &lt;tr&gt; 
        &lt;td&gt; data&lt;/td&gt; 
        &lt;td&gt; 2&lt;/td&gt; 
        &lt;td&gt; 1.78&lt;/td&gt; 
      &lt;/tr&gt;
      &lt;tr&gt; 
        &lt;td&gt; data&lt;/td&gt; 
        &lt;td&gt; 22&lt;/td&gt; 
        &lt;td&gt; 1.56&lt;/td&gt; 
      &lt;/tr&gt; 
    &lt;/tbody&gt; 
  &lt;/table&gt;&lt;/body&gt;&lt;/html&gt; 
  </code></pre>