amn41
amn41

Reputation: 1154

python yagmail table extra <td> tags in table

I'm using yagmail with python 2.7 to email a table.

yag = yagmail.SMTP(config.SENDER_UNAME, config.SENDER_PW)
recipient="<email>"
subject= "hello"
body="hi"
html_doc="""<!DOCTYPE html><html><head></head><body><TABLE cellpadding="4"  border="1" style="border-width:1px;border-style:solid;border-color:#000000;border-collapse:collapse;" >                         
  <COL width="100px">                                                                                                                                                                                       
  <COL width="100px">                                                                                                                                                                                       
  <COL width="100px">                                                                                                                                                                                       
 <TR>                                                                                                                                                                                                       
  <TH>product</TH>                                                                                                                                                                                          
  <TH># orders</TH>                                                                                                                                                                                         
  <TH>revenue</TH>                                                                                                                                                                                          
 </TR>                                                                                                                                                                                                      
 <TR>                                                                                                                                                                                                       
  <TD align="left">Type 1</TD>                                                                                                                                                                              
  <TD align="left">14</TD>                                                                                                                                                                                  
  <TD align="left">730.5</TD>                                                                                                                                                                               
 </TR>                                                                                                                                                                                                      
 <TR>                                                                                                                                                                                                       
  <TD align="left">Type 2</TD>                                                                                                                                                                              
  <TD align="left">18</TD>                                                                                                                                                                                  
  <TD align="left">1759.3</TD>                                                                                                                                                                              
 </TR>                                                                                                                                                                                                      
 <TR>                                                                                                                                                                                                       
  <TD align="left">total</TD>                                                                                                                                                                               
  <TD align="left">32</TD>                                                                                                                                                                                  
  <TD align="left">2489.8</TD>                                                                                                                                                                              
 </TR>                                                                                                                                                                                                      
</TABLE></body></html>"""

result =yag.send(recipient,subject, [body,html_doc],headers={"From":config.SENDER_FROM})

But in the email that gets sent the table looks like this, with extra cells and rows added. How can I prevent that from happening?

enter image description here

Upvotes: 2

Views: 442

Answers (0)

Related Questions