I'm trying to send png with yagmail module but i get this error :
Here is the code :
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")
When i just send text, it works. Any clue ?
If you want to send the image as an attachment, you can do this:
Refer to this
doc
for more information.