【发布时间】:2020-05-10 14:57:38
【问题描述】:
我正在尝试使用 yagmail 模块发送 png,但出现此错误:
代码如下:
import yagmail
import os
currentDirectory = os.getcwd()
path_fichier_screenshot2 = currentDirectory + "\\screenshot2.png"
print(path_fichier_screenshot2)
try:
yag = yagmail.SMTP(user="myemail", password='pwd')
contents = [yagmail.inline(path_fichier_screenshot2)]
yag.send("target_email", "test", contents)
print("Email sent successfully")
except:
print("Error, email was not sent")
当我只发送文本时,它可以工作。 有什么线索吗?
【问题讨论】:
-
您要将
png作为附件发送吗? -
您好,是的附件或更好,png 包含在电子邮件内容中。字数不多,内容太大,发不了邮件
标签: python python-3.x yagmail