Python 发送自动邮件

Python 发送自动邮件,python,Python,我正在创建自动邮件系统,我必须每天发送过滤后的excel值 我使用Pandas过滤excel值并将其存储在status中,当使用python发送邮件时,我遇到了如下错误 TypeError: sequence item 1: expected str instance, Series found 代码: 我只需要发送过滤后的值错误来自此行: msg.set_content("Kindly Go-Through the below mail",status) 该错误告诉您,状态是一个panda

我正在创建自动邮件系统,我必须每天发送过滤后的excel值

我使用Pandas过滤excel值并将其存储在status中,当使用python发送邮件时,我遇到了如下错误

TypeError: sequence item 1: expected str instance, Series found
代码:


我只需要发送过滤后的值

错误来自此行:

msg.set_content("Kindly Go-Through the below mail",status)
该错误告诉您,
状态
是一个
pandas.Series
msg.set\u content
无法处理它,必须将序列转换为字符串。
例如,尝试使用

body = ' '.join(map(str, list(status))))
msg.set_content("Kindly Go-Through the below mail",body)

body
是序列中所有值转换为字符串的串联(如果它们已经是字符串,您可以省略
map
函数)。

您让我们猜测错误在哪里。请编辑问题以包含完整的错误回溯消息。另外,向我们展示如何创建
msg
。msg=EmailMessage()msg['Subject']='Limit Sample Management System'msg['From']='abcd@gmail.com'msg['To']='abcd@gmail.com'msg.set_内容(“请仔细阅读下面的邮件”,状态)很抱歉,我真的是新手,在你的问题中添加额外的代码,而不是在评论中添加。
body = ' '.join(map(str, list(status))))
msg.set_content("Kindly Go-Through the below mail",body)