我的python程序出现问题。我已经输入了关于我的电子邮件和密码程序的正确信息,错误显示在下面
import smtplib, SSL
email="belginjarosh46@gmail.com"
password="my password"
port = 465
context = ssl.create_default_context()
server =smtplib.SMTP_SSL("smtp.gmail.com",port,context=context)
server.login(email,password)
message=" Hi I Am Belgin Android "
sender_mail=email,
receiver_email="belginjarosh46@gmail.com"
server.sendmail(sender_mail,receiver_email,message)
错误:
Traceback (most recent call last):
File "c:/Users/Belgin/Desktop/Python Coding/email_sending.py", line 10, in <module>
server.login(email,password)
File "G:Pythonlibsmtplib.py", line 734, in login
raise last_exception
File "G:Pythonlibsmtplib.py", line 723, in login
(code, resp) = self.auth(
File "G:Pythonlibsmtplib.py", line 646, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more atn5.7.8 https://support.google.com/mail/?p=BadCredentials f21sm2590687pfn.71 - gsmtp')
综上所述,我想问题在于谷歌不允许您使用默认用户密码登录,尤其是(但不仅限于(使用第二因素身份验证时。因此,要为第三方应用程序使用密码,需要创建特定于应用程序的密码。