1
"와"내부 메일을 보내는 것은 실패 이유 코드파이썬 : 나는 궁금 할 때 블록
test = smtplib.SMTP('smtp.gmail.com', 587)
test.ehlo()
test.starttls()
test.ehlo()
test.login('address','passw')
test.sendmail(sender, recipients, composed)
test.close()
작동하지만이
with smtplib.SMTP('smtp.gmail.com', 587) as s:
s.ehlo()
s.starttls()
s.ehlo()
s.login('address','passw')
s.sendmail(sender, recipients, composed)
s.close()
처럼 쓸 때 메시지
실패Unable to send the email. Error: <class 'AttributeError'>
Traceback (most recent call last):
File "py_script.py", line 100, in <module>
with smtplib.SMTP('smtp.gmail.com', 587) as s:
AttributeError: __exit__
왜 이런 일이 무엇입니까? (라즈베리 파이에 python3) 들으
다음이 잘못 (?) http://robertwdempsey.com/python3-email-with-attachments-using-gmail/ – Gerard
그러나 python3에? 내가 버전 3에서 노력하고있어 편집 : 좋아, 파이썬 3.2.3, 고마워요 :) – Gerard
@ 제라드 : 설명서는 그것이 파이썬 3.3에서 컨텍스트 관리자가되었다는 내용의. –