arleigh418 / python-and-Taiwan-stock-market

Python 金融市場賺大錢聖經:寫出你的專屬指標
54 stars 17 forks source link

SMTP問題 #12

Open RJ0223 opened 2 years ago

RJ0223 commented 2 years ago

您好, 我在嘗試使用SMTP發信時,遇到 smtplib.SMTPAuthenticationError: (535, b'authentication failed (#5.7.1)') 的錯誤問題。 gmail的低安全模式我已經開啟,但仍然無法順利登入發信,還請您協助,謝謝您。

arleigh418 commented 2 years ago

您好,很高興您提問~ authentication failed基本就是帳戶的議題,與程式較無關係,請再次確保:

  1. 帳密確實沒有輸錯,您可以將account跟password print出來仔細確認,是否有錯誤的字符、空白及不正確的帳密
  2. 確保程式正確,並且有starttls()。 server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(user_id, password)
  3. Port基本以587為主,但您可以嘗試換成25看能否解決。

上述如果都確認過了,尚無法解決問題,或許您可以貼程式碼上來(請去除自己的帳密資訊),我們再來看看。