我正在尝试使用 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")
当我只发送文本时,它可以工作。有什么线索吗?