equeny / tornadomail Goto Github PK
View Code? Open in Web Editor NEWDjango mail system ported to tornado and made asynchronous
Django mail system ported to tornado and made asynchronous
Do you have plans to release a new version including EmailFromTemplate
class and support for reply_to
?
I periodically run into this AssertionError when sending mail. The culprit seems to be line 356 in getreply,
line = yield gen.Task(self.sock.read_until, '\n')
but I'm not sure about the proper fix. Posting here for discussion.
[E 141009 17:15:23 ioloop:491] Exception in callback <functools.partial object at 0x7f1460c62c00>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 477, in _run_callback
callback()
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 354, in wrapper
callback(_args)
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 343, in _handle_exception
if tail.exit(_exc):
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 186, in exit
return self.exception_handler(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 142, in handle_exception
return runner.handle_exception(typ, value, tb)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 580, in handle_exception
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 529, in run
yielded = self.gen.throw(_exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/message.py", line 260, in send
result = yield gen.Task(self.get_connection(fail_silently).send_messages, [self])
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 343, in _handle_exception
if tail.exit(_exc):
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 186, in exit
return self.exception_handler(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 142, in handle_exception
return runner.handle_exception(typ, value, tb)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 580, in handle_exception
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 529, in run
yielded = self.gen.throw(_exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/backends/smtp.py", line 88, in send_messages
sent = yield gen.Task(self._send, message)
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 343, in _handle_exception
if tail.exit(_exc):
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 186, in exit
return self.exception_handler(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 142, in handle_exception
return runner.handle_exception(typ, value, tb)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 580, in handle_exception
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 529, in run
yielded = self.gen.throw(_exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/backends/smtp.py", line 107, in _send
email_message.message().as_string())
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 343, in _handle_exception
if tail.exit(_exc):
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 186, in exit
return self.exception_handler(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 142, in handle_exception
return runner.handle_exception(typ, value, tb)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 580, in handle_exception
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 529, in run
yielded = self.gen.throw(_exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/smtplib.py", line 748, in sendmail
yield gen.Task(self.ehlo_or_helo_if_needed)
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 343, in _handle_exception
if tail.exit(_exc):
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 186, in exit
return self.exception_handler(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 142, in handle_exception
return runner.handle_exception(typ, value, tb)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 580, in handle_exception
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 529, in run
yielded = self.gen.throw(_exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/smtplib.py", line 552, in ehlo_or_helo_if_needed
result = yield gen.Task(self.ehlo)
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 574, in inner
self.set_result(key, result)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 500, in set_result
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 529, in run
yielded = self.gen.throw(_exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/smtplib.py", line 409, in ehlo
result = yield gen.Task(self.getreply)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 557, in run
self.yield_point.start(self)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 377, in start
self.func(_self.args, *_self.kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 159, in wrapper
runner.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 529, in run
yielded = self.gen.throw(_exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/smtplib.py", line 356, in getreply
line = yield gen.Task(self.sock.read_until, '\n')
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 557, in run
self.yield_point.start(self)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 377, in start
self.func(_self.args, **self.kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 161, in read_until
self._set_read_callback(callback)
File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 418, in _set_read_callback
assert not self._read_callback, "Already reading"
AssertionError: Already reading
Hi,
The package downloaded from pypi has version 0.1.1 in setup.py (instead of 0.1.2).
This breaks installing/upgrading via pip.
Thanks.
Downloading/unpacking tornadomail
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
pip install tornadomail
Downloading/unpacking tornadomail
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
Error <urlopen error [Errno 1] _ssl.c:504: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure> while getting http://github.com/downloads/equeny/tornadomail/tornadomail-0.1.2.tar.gz (from https://pypi.python.org/simple/tornadomail/)
Cleaning up...
Exception:
Traceback (most recent call last):
File "/home/hell/trash/env/lib/python2.7/site-packages/pip/basecommand.py", line 134, in main
status = self.run(options, args)
File "/home/hell/trash/env/lib/python2.7/site-packages/pip/commands/install.py", line 236, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/hell/trash/env/lib/python2.7/site-packages/pip/req.py", line 1092, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/home/hell/trash/env/lib/python2.7/site-packages/pip/req.py", line 1238, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
File "/home/hell/trash/env/lib/python2.7/site-packages/pip/download.py", line 602, in unpack_http_url
resp = _get_response_from_url(target_url, link)
File "/home/hell/trash/env/lib/python2.7/site-packages/pip/download.py", line 638, in _get_response_from_url
resp = urlopen(target_url)
File "/home/hell/trash/env/lib/python2.7/site-packages/pip/download.py", line 176, in __call__
response = self.get_opener(scheme=scheme).open(url)
File "/usr/lib64/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib64/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.7/urllib2.py", line 442, in error
result = self._call_chain(*args)
File "/usr/lib64/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 629, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib64/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib64/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.7/urllib2.py", line 442, in error
result = self._call_chain(*args)
File "/usr/lib64/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 629, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib64/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1224, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1186, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:504: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>
According to https://pypi.python.org/pypi policy changes they are going to require to upload packages to their server, it sounds like security fixes.
In addition github starts to use sslv3 which can not be used via python built-in urllib2.
Can you re-upload your package without download url which is mapped to github, just source upload like:
python setup.py sdist upload
Of course it is still possible to install library manually, but it breaks CI build at all!
Thanks!
hello
just run the example and it exits without any results, put the email and no clue!
Subject.
message is sent ok, but i get error
Traceback (most recent call last):
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/stack_context.py", line 183, in wrapped
callback(_args, *_kwargs)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 332, in inner
self.set_result(key, result)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 274, in set_result
self.run()
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 303, in run
yielded = self.gen.send(next)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornadomail/smtplib.py", line 369, in getreply
callback(errcode, errmsg)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 332, in inner
self.set_result(key, result)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 274, in set_result
self.run()
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 303, in run
yielded = self.gen.send(next)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornadomail/smtplib.py", line 678, in starttls
callback(resp, reply)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 332, in inner
self.set_result(key, result)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 274, in set_result
self.run()
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 318, in run
self.yield_point.start(self)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 207, in start
self.func(_self.args, *_self.kwargs)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 91, in wrapper
Runner(gen).run()
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 318, in run
self.yield_point.start(self)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/gen.py", line 207, in start
self.func(_self.args, *_self.kwargs)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornadomail/smtplib.py", line 327, in putcmd
self.send(str, callback=callback)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornadomail/smtplib.py", line 314, in send
self.sock.write(str, callback)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/iostream.py", line 218, in write
self._add_io_state(self.io_loop.WRITE)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/iostream.py", line 544, in _add_io_state
self.socket.fileno(), self._handle_events, self._state)
File "/home/alexp/shop/.ve/lib/python2.6/site-packages/tornado/ioloop.py", line 182, in add_handler
self._impl.register(fd, events | self.ERROR)
IOError: [Errno 17] File exists
Hello, I tested the sample code and is returning this error:
ERROR:tornado.application:Exception in callback <_functools.partial object at 0x0000000105a14288>
Traceback (most recent call last):
File "/Users/murilobsd/Documents/Projetos/europlak/venv/site-packages/tornado/ioloop.py", line 477, in _run_callback
callback()
File "/usr/local/Cellar/pypy/2.3.1/libexec/lib_pypy/_functools.py", line 22, in __call__
return self.func(*(self.args + fargs), **fkeywords)
File "/Users/murilobsd/Documents/Projetos/europlak/venv/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/Users/murilobsd/Documents/Projetos/europlak/venv/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "/Users/murilobsd/Documents/Projetos/europlak/venv/site-packages/tornado/iostream.py", line 362, in wrapper
self.close(exc_info=True)
File "/Users/murilobsd/Documents/Projetos/europlak/venv/site-packages/tornado/iostream.py", line 262, in close
self.io_loop.remove_handler(self.fileno())
File "/Users/murilobsd/Documents/Projetos/europlak/venv/site-packages/tornado/iostream.py", line 683, in fileno
return self.socket.fileno()
File "<string>", line 1, in fileno
File "/usr/local/Cellar/pypy/2.3.1/libexec/lib-python/2.7/socket.py", line 164, in _dummy
raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
I'm using pypy=2.3.1 and tornado=3.2.2. There are likely to be incompatible with pypy? Thanks
Hi,
I'm trying to run in python 3.3 and ended up with following error:
from tornadomail.backends.smtp import EmailBackend
File "/home/shafiul/TestEnv/local/lib/python3.3/dist-packages/tornadomail/init.py", line 11, in
from utils import CachedDnsName, DNS_NAME
ImportError: No module named 'utils'
Any ideas?
the project example code show blow:
def post(self):
def _finish(num):
print 'sended %d message(s)' % num
self.render("index.html")
message = EmailMessage(
self.get_argument('subject'),
self.get_argument('message'),
'<your google mail>',
[self.get_argument('email')],
connection=self.mail_connection
)
message.send()#callback=_finish)
self.render("index.html")
but if don't use tornado.web.asynchronous to decorate the post method, the socket will closed after the post method return
and cause:
Exception in callback <tornado.stack_context._StackContextWrapper object at 0x8cf2784>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/ioloop.py", line 399, in _run_callback
callback()
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/iostream.py", line 304, in wrapper
callback(*args)
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/stack_context.py", line 199, in wrapped
callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/gen.py", line 357, in inner
self.set_result(key, result)
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/gen.py", line 291, in set_result
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/gen.py", line 321, in run
yielded = self.gen.send(next)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/smtplib.py", line 385, in docmd
self.getreply(callback)
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/gen.py", line 107, in wrapper
runner.run()
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/gen.py", line 319, in run
yielded = self.gen.throw(*exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornadomail/smtplib.py", line 356, in getreply
line = yield gen.Task(self.sock.read_until, '\n')
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/gen.py", line 341, in run
self.yield_point.start(self)
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/gen.py", line 223, in start
self.func(*self.args, **self.kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/iostream.py", line 160, in read_until
self._check_closed()
File "/usr/local/lib/python2.7/dist-packages/tornado-2.2-py2.7.egg/tornado/iostream.py", line 535, in _check_closed
raise IOError("Stream is closed")
IOError: Stream is closed
WARNING:tornado.general:Connect error on fd 9: [Errno 101] Network is unreachable
ERROR:tornado.application:Uncaught exception POST / (10.129.148.175)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.