Closed githhhh closed 6 years ago
为了更好的debug,如果可以的提供一下以下信息 1.请用pip3 list 看一下zmail版本 2.使用的邮箱服务商(例如163、qq等)
± pip3 list DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning. certifi (2018.1.18) chardet (3.0.4) idna (2.6) pip (9.0.3) PyYAML (3.12) requests (2.18.4) setuptools (20.10.1) urllib3 (1.22) zmail (0.0.9) You are using pip version 9.0.3, however version 10.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. 邮箱服务商使用 阿里云邮箱
尝试一下reinstall,现在最新版本为0.1.4:
xx@MacBook-Pro ~/Desktop> pip uninstall zmail 1
Uninstalling zmail-0.1.4:
Would remove:
/Users/xx/.pyenv/versions/3.5.2/lib/python3.5/site-packages/test/
/Users/xx/.pyenv/versions/3.5.2/lib/python3.5/site-packages/zmail-0.1.4.dist-info/
/Users/xx/.pyenv/versions/3.5.2/lib/python3.5/site-packages/zmail/
Proceed (y/n)? y
Successfully uninstalled zmail-0.1.4
xx@MacBook-Pro ~/Desktop> pip install zmail
Collecting zmail
Using cached https://files.pythonhosted.org/packages/5c/e5/b44a9fa57219e3704ae5eb33e6598443e71f8f2bc1c7503d8abd797f0545/zmail-0.1.4-py3-none-any.whl
Installing collected packages: zmail
Successfully installed zmail-0.1.4
xx@MacBook-Pro ~/Desktop> python SendMail.py
Traceback (most recent call last):
File "SendMail.py", line 1, in
这个是python3.5 3.6的语法兼容问题 , 现在已经修复 ,重新安装一下即可
多谢,解决了。但是 3.6.0 还是有问题
Traceback (most recent call last):
File "SendMail.py", line 1, in
然后我切到3.5.2 是没问题的
切换到3.6.0有这个问题是因为你没在py3.6里面安装zmail,安装完就好啦~
Traceback (most recent call last): File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/smtplib.py", line 353, in send self.sock.sendall(s) File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/ssl.py", line 891, in sendall v = self.send(data[count:]) File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/ssl.py", line 861, in send return self._sslobj.write(data) File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/ssl.py", line 586, in write return self._sslobj.write(data) socket.timeout: The write operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "SendMail.py", line 48, in
server.send_mail('xxx', mail_content)
File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/site-packages/zmail/server.py", line 54, in send_mail
server.send_ssl(recipients, message, timeout)
File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/site-packages/zmail/server.py", line 175, in send_ssl
server.sendmail(self.user, recipient, message.as_string())
File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/smtplib.py", line 877, in sendmail
(code, resp) = self.data(msg)
File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/smtplib.py", line 567, in data
self.send(q)
File "/Users/bin/.pyenv/versions/3.5.2/lib/python3.5/smtplib.py", line 356, in send
raise SMTPServerDisconnected('Server not connected')
smtplib.SMTPServerDisconnected: Server not connected