I’ve made an email sending script, but I don’t know how to send a file with it. Help!
filename = 'image.png'
my_user = '[email protected]' #
my_pass = 'my app code'
smtpserver = smtplib.SMTP_SSL('smtp.gmail.com', 465)
smtpserver.ehlo()
smtpserver.login(my_user, my_pass)
sent_from = my_user
sent_to = 'myotheremail' # Send it to self (as test)
email_text = 'This is a test'
smtpserver.sendmail(sent_from, sent_to, email_text, filename)
smtpserver.close()