烧瓶邮件的文件描述符错误

时间:2015-06-29 23:55:16

标签: python email flask

我正在使用flask-mail向用户发送包含新密码的电子邮件。 我运行代码时不断收到IOError错误的文件描述符

Traceback (most recent call last):
File "C:\Python27\lib\site-packages\flask\app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "C:\Python27\lib\site-packages\flask\app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\mpelixp\Documents\joanna\app2api.py", line 95, in login
mail.send(msg)
File "C:\Python27\lib\site-packages\flask_mail.py", line 491, in send
with self.connect() as connection:
File "C:\Python27\lib\site-packages\flask_mail.py", line 144, in __enter__
self.host = self.configure_host()
File "C:\Python27\lib\site-packages\flask_mail.py", line 165, in configure_host
host.login(self.mail.username, self.mail.password)
File "C:\Python27\lib\smtplib.py", line 582, in login
self.ehlo_or_helo_if_needed()
File "C:\Python27\lib\smtplib.py", line 542, in ehlo_or_helo_if_needed
if not (200 <= self.ehlo()[0] <= 299):
File "C:\Python27\lib\smtplib.py", line 414, in ehlo
(code, msg) = self.getreply()
File "C:\Python27\lib\smtplib.py", line 370, in getreply
print>>stderr, 'reply:', repr(line)
IOError: [Errno 9] Bad file descriptor

这是否与套接字和连接有关? 如果需要,我可以发布完整的追溯

编辑完整追溯:

  window.removeEventListener('wheel', onwheel, false);
  window.removeEventListener('mousedown', ondown, false);

  function onwheel(e) {
    console.info('wheeled, e:', e);
  }

  function ondown(e) {
    console.info('downed, e:', e);
  }

  window.addEventListener('wheel', onwheel, false);
  window.addEventListener('mousedown', ondown, false);

1 个答案:

答案 0 :(得分:0)

如果不起作用,您可以随时使用yagmail

import yagmail
yag = yagmail.SMTP(MAIL_USERNAME, MAIL_PASSWORD)
yag.send(to = e, contents = 'Your password is ' + hashedp)

首先使用pip install yagmail(或pip3 for python 3)安装它。

它具有很多功能,包括轻松发送HTML电子邮件(带回退),通过指向文件和无密码脚本进行附加。

有关github的更多信息,请参阅