[英]Python Email Server not responding
Input输入
import smtplib
conn = smtplib.SMTP('imap.gmail.com',587)
conn.ehlo()
conn.starttls()
conn.login('loginmail@gmail.com', 'password')
conn.sendmail('sender1@gmail.com','sender2@gmail.com','Subject: What you like? \n\n Reply Reply Reply')
conn.quit()
Output and Error输出和错误
Traceback (most recent call last):
File "E:\python\openCV\em.py", line 4, in <module>
conn = smtplib.SMTP('imap.gmail.com',587)
File "C:\Users\loges\AppData\Local\Programs\Python\Python36\lib\smtplib.py", line 251, in _init_
(code, msg) = self.connect(host, port)
File "C:\Users\loges\AppData\Local\Programs\Python\Python36\lib\smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Users\loges\AppData\Local\Programs\Python\Python36\lib\smtplib.py", line 307, in _get_socket
self.source_address)
File "C:\Users\loges\AppData\Local\Programs\Python\Python36\lib\socket.py", line 724, in create_connection
raise err
File "C:\Users\loges\AppData\Local\Programs\Python\Python36\lib\socket.py", line 713, in create_connection
sock.connect(sa)
TimeoautError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Please help me to solve this issue.请帮我解决这个问题。 It looks like server issue.看起来像服务器问题。 I have included the login mail and password, 2 sender emails and a subject.我已经包括了登录邮件和密码、2 个发件人电子邮件和一个主题。 I want to send a zip file.我想发送一个 zip 文件。 The program is showing error and I have provided the error above程序显示错误,我提供了上面的错误
You are connecting to the wrong server.您正在连接到错误的服务器。 Should be:应该:
conn = smtplib.SMTP('smtp.gmail.com', 587)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.