0

I have a code which uses win32com to open Outlook and send mail. I am trying to send a table which is in myexample.html file to a recipient. However when I use

msg.body=open('myexample.html').read()

This is what comes in the mail that I've sent

table border="1" class="dataframe"> 
  <thead> 
    <tr style="text-align: right;"> 
      <th>DG Lead</th> 
    </tr> 
  </thead> 
  <tbody> 
    <tr> 
      <td>Krishnamurthy Ramamurthy</td> 
      <td>324</td> 
> 
    <tr> 

But I want a table view of this. How can I get that?

Abul
  • 197
  • 2
  • 4
  • 15
  • 5
    Possible duplicate of [Sending HTML email using Python](https://stackoverflow.com/questions/882712/sending-html-email-using-python) and [Send table as an email body](https://stackoverflow.com/questions/38275467/send-table-as-an-email-body-not-attachment-in-python) – Zero Jul 05 '17 at 06:46
  • Hey, I figured the answer to it. Just had to alter a line of code. – Abul Jul 05 '17 at 06:51

1 Answers1

0

Figured out the answer to it. Just need to alter

msg.body = body

to

msg.HTMLBody  = body
Abul
  • 197
  • 2
  • 4
  • 15