python yagmail表中的额外标签

时间:2016-04-30 12:14:14

标签: python-2.7 yagmail

我正在使用带有python 2.7的yagmail来通过电子邮件发送表格。

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})

但是在发送的电子邮件中,表格看起来像这样,添加了额外的单元格和行。我该如何防止这种情况发生?

enter image description here

0 个答案:

没有答案