本帖最后由 axwa 于 2021-4-15 10:23 编辑
试了的 不行的 ,谢谢 他提示[Python] 纯文本查看 复制代码 ['新闻']
Traceback (most recent call last):
File "C:\Program Files\Python38-32\lib\email\message.py", line 356, in set_charset
cte(self)
TypeError: 'str' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/untitled/测试/自动发送消息1.0.py", line 68, in <module>
auto_play.mail()
File "C:/Users/Administrator/PycharmProjects/untitled/测试/自动发送消息1.0.py", line 55, in mail
msg.attach(MIMEText(mail_content, 'plain', 'utf-8'))
File "C:\Program Files\Python38-32\lib\email\mime\text.py", line 42, in __init__
self.set_payload(_text, _charset)
File "C:\Program Files\Python38-32\lib\email\message.py", line 321, in set_payload
self.set_charset(charset)
File "C:\Program Files\Python38-32\lib\email\message.py", line 364, in set_charset
payload = payload.encode('ascii', 'surrogateescape')
AttributeError: 'list' object has no attribute 'encode'
Process finished with exit code 1 |