Here is the code that I want to compile
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
from email.mime.text import MIMEText
import smtplib
def send_mail(email, password, text):
server = smtplib.SMTP_SSL("smtp.gmail.com:465")
server.login(email, password)
server.sendmail(email, email, text)
text = msg.as_string()
server.quit()
f = open("c1.png")
send_mail("xxxxxxxxxxxxxx@gmail.com","xxxxxxxx",f)
and the output
Here is what I tried so far:
Try to generate a password from apps password and use that code instead of the users actual password.
An App Password is a 16-digit passcode that gives an app or device restricted access to your Google Account without having to divulge your personal password and complete access to your Google Account.
more info on Sign in with App Passwords
This is normally due to the user having 2fa enabled.
Another option would be to use xoauth2.