我正在尝试通过邮件发送熊猫数据框。我尝试过,但是给了我html文件,我希望将数据框显示在邮件正文中
请参见我下面的代码
send ="hiro-alert@one.com"
reciever="vishal.suryavanshi@see.com"
subject="incident details "
msg = MIMEMultipart()
msg['From'] = send
msg['To'] = reciever
msg['Subject'] =subject
html = """\
<html>
<head></head>
<body>
{0}
</body>
</html>""".format(ticket_details.to_html())
messagePlain = 'Look at the incident details'
msg.attach(MIMEText(messagePlain, 'plain'))
msg.attach(MIMEText(html, 'html'))
server = smtplib.SMTP("mailrelay.nisource.net")
#pdb.set_trace()
#print ("excuse me")
#pdb.set_trace()
#print ("hello")
#pdb.set_trace()
server.sendmail(send,reciever , msg.as_string())
#pdb.set_trace()
server.quit()
我希望我的数据框以表格格式显示在邮件正文中