0
hier ist mein Skript:
from email.mime.text import MIMEText
import smtplib
msg=MIMEText('hi, send by python.....','plain','utf-8')
from_addr='[email protected]'
passowrd='psw'
to_addr='[email protected]'
s=smtplib.SMTP('smtp.gmail.com',587)
s.login(from_addr,password)
s.sendmail(from_addr, [to_addr], msg.as_string())
, wenn es ausgeführt wird, Fehler auftritt:
Traceback (most recent call last):
File "C:\Users\bicuilin\Desktop\begin.py", line 17, in <module>
s.login(from_addr, password)
File "C:\Users\bicuilin\AppData\Local\Programs\Python\Python35\lib\smtplib.py", line 696, in login
"SMTP AUTH extension not supported by server.")
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
Ich versuche, es zu beheben. Ich füge folgenden Code:
...
s.ehlo()
s.starttls()
s.login(from_addr, password)
s.sendmail(from_addr, [to_addr], msg.as_string())
s.quit()
hier kommt Fehler, den ich wirklich nicht verstehen:
Traceback (most recent call last):
File "C:\Users\bicuilin\Desktop\begin.py", line 20, in <module>
s.login(from_addr, password)
File "C:\Users\bicuilin\AppData\Local\Programs\Python\Python35\lib\smtplib.py", line 729, in login
raise last_exception
File "C:\Users\bicuilin\AppData\Local\Programs\Python\Python35\lib\smtplib.py", line 720, in login
initial_response_ok=initial_response_ok)
File "C:\Users\bicuilin\AppData\Local\Programs\Python\Python35\lib\smtplib.py", line 641, in auth
raise SMTPAuthenticationError(code, resp)
smtplib.SMTPAuthenticationError: (534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbvK\n5.7.14 1h8JVCjH3EdlnG4ye0St7PIWFsYfjtuO_qovrt6r-spvSMGNbeCxbpXuo3HfqK535dgJy2\n5.7.14 Tjz1zrEZI8QqRc0GyXD2t3Xa0rj_MVHbzX5fM1f2zgbFyoP9YUbwCyaRD5guosxyv3HcS8\n5.7.14 fvB_ORP6_djncJPUwGw98BDCTo2pw3RSvgYHAvS_xO-T97Hw2z35g3AKPW9Bb5E9EcpAgg\n5.7.14 pewpsm0VngKqoxhYhtFwHBW_8s1ig> Please log in via your web browser and\n5.7.14 then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 a67sm1686251qkc.24 - gsmtp')
In meinem Mailer, gmail smtp-Port ist auf 465 –
Dank für Ihren Rat festgelegt, auch wenn es immer noch nicht funktioniert. – wayin