I am using python 3.6.2 . I am trying to check the validity of a gmail password using python. Here is my code-
import os, sys, time, subprocess, collections, datetime, smtplib
from datetime import datetime
def passwordcheck(usr,psw):
server=smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
try:
server.login(usr,psw)
ret = True
except:
ret = False
server.quit()
return ret
usr="myemail@gmail.com"
chk=passwordcheck(usr,"mypass")
print(chk)
But here the problem is whatever the password (right or wrong) it always returns False.How can i solve this issue?
Aucun commentaire:
Enregistrer un commentaire