2016-12-12 3 views
0

私は誰かが私に説明してくださいすることができます認証の問題は

Traceback (most recent call last): 
File "C:/Users/129/PycharmProjects/smtp.py", line 34, in <module> 
s.login(smtpUser,smtpPass) 
File "C:\WinPython-64bit-3.4.4.2\python-3.4.4.amd64\lib\smtplib.py", line 652, in login 
raise SMTPAuthenticationError(code, resp) 
smtplib.SMTPAuthenticationError: (501, b'5.5.2 Cannot Decode response q9sm74360527pfg.47 - gsmtp') 
Process finished with exit code 1 

is--パイソンscript--

import smtplib 
smtpUser='[email protected]' 
smtpPass='1234' 
toAdd='[email protected]' 
fromAdd=smtpUser 
subject='Python test' 
header='To:' +toAdd+'\n'+'From:'+fromAdd+'\n' +'Subject:'+ subject 
body='From within a python script' 

print(header + '\n'+ body) 
s= smtplib.SMTP('smtp.gmail.com',587) 
s.ehlo() 
s.starttls() 
s.ehlo() 
s.login(smtpUser,smtpPass) 
s.sendmail(fromAdd,toAdd,header +'\n' + body) 
s.quit() 

その後、エラーMSGで電子メールを送信するための手順の下に続くものを私が間違っていない場合は、それはGoogleのセキュリティに関連しているエラーです。

答えて

0

私はGmailアカウントからメールを送信するために、これを使用:

s = smtplib.SMTP('smtp.gmail.com:587') 
s.starttls() 
s.login(username, password) 
s.sendmail(from_mail, to_mail, msg.as_string()) 
s.quit() 

は、ルックhereを持っています。それは私のために働いた。