I want to test whether the password entered by the user of his google account is correct or not, but I am always getting INCORRECT
as an output
How do I perform this?
Before asking this question I’ve tried :
JavaScript
x
17
17
1
import smtplib as s
2
3
ID = input("ENTER YOUR MAIL ID")
4
PASSW = input("pass")
5
6
server = s.SMTP("smtp.gmail.com", 587)
7
server.starttls()
8
9
a = server.login(ID,PASSW)
10
11
if a == True:
12
print("CORRECT")
13
else:
14
print("INCORRECT")
15
16
server.quit()
17
Advertisement
Answer
This should work just make sure Less secure app is enabled
JavaScript
1
14
14
1
import smtplib as s
2
3
ID = '' #your mail
4
PASSW = input("pass : ")
5
6
server = s.SMTP("smtp.gmail.com", 587)
7
server.starttls()
8
try:
9
server.login(ID,PASSW)
10
except SMTPAuthenticationError:
11
print("Password is wrong")
12
13
server.quit()
14