2016-11-10 6 views
0

파이썬에서 이메일을 보낼 수 없습니다. 아마도 보안 문제가있을 것입니다. 누군가 나에게 힌트를 줄 수 있습니까?파이썬 메일 보내기 시간 초과 오류

server = smtplib.SMTP('smtp.gmail.com', 587) 
File "D:\Tools\Lib\smtplib.py", line 244, in __init__ 
    (code, msg) = self.connect(host, port) 
File "D:\Tools\Lib\smtplib.py", line 310, in connect 
    raise socket.error, msg 
    error: (10060, 'Operation timed out') 

답변

0

() 포트 587는 SSL (TLS)을 기대하기 때문에 가서 얻을에서 당신이 smtplib.SMTP_SSL을 사용해야합니다

import smtplib 

server = smtplib.SMTP('smtp.gmail.com', 587) 

server.starttls() 

#Next, log in to the server 
server.login("***@gmail.com", "PASSWORD") 

#Send the mail 
msg = "Hello!" 
# The /n separates the message from the headers 
server.sendmail("***@gmail.com", "***@gmail.com", msg) 
server.quit() 

이것은 내가 오류는 다음과 같습니다 이것은 코드입니다. Gmail은 때때로 Gmail을 블록으로

https://docs.python.org/2/library/smtplib.html#smtplib.SMTP_SSL

0

확인이 오류를 반환 오류가 발생할 것

enter image description here

+0

응용 프로그램에서 서명, 그는 여전히이 작업을 수행해야 할 수 있습니다 만이 원인이 아니다 특별한 오류. – Ajurna