[GH-ISSUE #547] webmail with html composer enabled -> send a message with empty body fails (action never ends) #521

Closed
opened 2026-02-27 11:12:12 +03:00 by kerem · 9 comments
Owner

Originally created by @themr0c on GitHub (Apr 14, 2014).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/547

Originally assigned to: @tonioo on GitHub.

Condition: the html composer is enabled. (If the text editor is enabled, no issue).

Create a new message.

Leave the body empty.

Send the message.

The message can't be sent, we get following backtrace on the server, but we don't get any error displayed in the GUI: the send button stays grey and action never ends.

backtrace:

Internal Server Error: /accounts/logout/
Traceback (most recent call last):
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/core/views/auth.py", line 64, in dologout
    events.raiseEvent("UserLogout", request)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/lib/events.py", line 145, in raiseEvent
    callback(*args, **kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/lib/events.py", line 98, in wrapped_f
    return f(*args, **kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/general_callbacks.py", line 24, in userlogout
    if not request.user.mailbox_set.count():
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/utils/functional.py", line 205, in inner
    return func(self._wrapped, *args)
AttributeError: 'AnonymousUser' object has no attribute 'mailbox_set'
Internal Server Error: /webmail/
Traceback (most recent call last):
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/admin/lib.py", line 27, in wrapped_f
    return f(request, *args, **kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 509, in index
    response = globals()[action](request)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 385, in compose
    status, resp = send_mail(request, posturl=url)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 665, in send_mail
    textbody = html2plaintext(body)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 601, in html2plaintext
    html = lxml.html.fromstring(content)
  File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 634, in fromstring
    doc = document_fromstring(html, parser=parser, base_url=base_url, **kw)
  File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 532, in document_fromstring
    value = etree.fromstring(html, parser, **kw)
  File "lxml.etree.pyx", line 2754, in lxml.etree.fromstring (src/lxml/lxml.etree.c:54631)
  File "parser.pxi", line 1578, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:82748)
  File "parser.pxi", line 1450, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:81481)
  File "parser.pxi", line 925, in lxml.etree._BaseParser._parseUnicodeDoc (src/lxml/lxml.etree.c:77905)
  File "parser.pxi", line 569, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:74472)
  File "parser.pxi", line 650, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:75363)
  File "parser.pxi", line 599, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:74827)
XMLSyntaxError: line 184: htmlParseEntityRef: no name
Originally created by @themr0c on GitHub (Apr 14, 2014). Original GitHub issue: https://github.com/modoboa/modoboa/issues/547 Originally assigned to: @tonioo on GitHub. Condition: the html composer is enabled. (If the text editor is enabled, no issue). Create a new message. Leave the body empty. Send the message. The message can't be sent, we get following backtrace on the server, but we don't get any error displayed in the GUI: the send button stays grey and action never ends. backtrace: ``` Internal Server Error: /accounts/logout/ Traceback (most recent call last): File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/core/views/auth.py", line 64, in dologout events.raiseEvent("UserLogout", request) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/lib/events.py", line 145, in raiseEvent callback(*args, **kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/lib/events.py", line 98, in wrapped_f return f(*args, **kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/general_callbacks.py", line 24, in userlogout if not request.user.mailbox_set.count(): File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/utils/functional.py", line 205, in inner return func(self._wrapped, *args) AttributeError: 'AnonymousUser' object has no attribute 'mailbox_set' Internal Server Error: /webmail/ Traceback (most recent call last): File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view return view_func(request, *args, **kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/admin/lib.py", line 27, in wrapped_f return f(request, *args, **kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 509, in index response = globals()[action](request) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 385, in compose status, resp = send_mail(request, posturl=url) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 665, in send_mail textbody = html2plaintext(body) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 601, in html2plaintext html = lxml.html.fromstring(content) File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 634, in fromstring doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 532, in document_fromstring value = etree.fromstring(html, parser, **kw) File "lxml.etree.pyx", line 2754, in lxml.etree.fromstring (src/lxml/lxml.etree.c:54631) File "parser.pxi", line 1578, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:82748) File "parser.pxi", line 1450, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:81481) File "parser.pxi", line 925, in lxml.etree._BaseParser._parseUnicodeDoc (src/lxml/lxml.etree.c:77905) File "parser.pxi", line 569, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:74472) File "parser.pxi", line 650, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:75363) File "parser.pxi", line 599, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:74827) XMLSyntaxError: line 184: htmlParseEntityRef: no name ```
kerem 2026-02-27 11:12:12 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@tonioo commented on GitHub (Apr 14, 2014):

It seems you mixed two different stack traces... I'm not able to reproduce this issue, it works just fine for me.
Have you tried to reproduce it ?

<!-- gh-comment-id:40377384 --> @tonioo commented on GitHub (Apr 14, 2014): It seems you mixed two different stack traces... I'm not able to reproduce this issue, it works just fine for me. Have you tried to reproduce it ?
Author
Owner

@themr0c commented on GitHub (Apr 15, 2014):

I just retested it: stracktrace is indeed different :

Internal Server Error: /webmail/
Traceback (most recent call last):
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/admin/lib.py", line 27, in wrapped_f
    return f(request, *args, **kwargs)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 509, in index
    response = globals()[action](request)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 385, in compose
    status, resp = send_mail(request, posturl=url)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 665, in send_mail
    textbody = html2plaintext(body)
  File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 601, in html2plaintext
    html = lxml.html.fromstring(content)
  File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 634, in fromstring
    doc = document_fromstring(html, parser=parser, base_url=base_url, **kw)
  File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 532, in document_fromstring
    value = etree.fromstring(html, parser, **kw)
  File "lxml.etree.pyx", line 2754, in lxml.etree.fromstring (src/lxml/lxml.etree.c:54631)
  File "parser.pxi", line 1578, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:82748)
  File "parser.pxi", line 1450, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:81481)
  File "parser.pxi", line 925, in lxml.etree._BaseParser._parseUnicodeDoc (src/lxml/lxml.etree.c:77905)
  File "parser.pxi", line 569, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:74472)
  File "parser.pxi", line 650, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:75363)
  File "parser.pxi", line 599, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:74827)
XMLSyntaxError: line 61: htmlParseEntityRef: expecting ';'

<!-- gh-comment-id:40458288 --> @themr0c commented on GitHub (Apr 15, 2014): I just retested it: stracktrace is indeed different : ``` Internal Server Error: /webmail/ Traceback (most recent call last): File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 25, in _wrapped_view return view_func(request, *args, **kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/admin/lib.py", line 27, in wrapped_f return f(request, *args, **kwargs) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 509, in index response = globals()[action](request) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/views.py", line 385, in compose status, resp = send_mail(request, posturl=url) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 665, in send_mail textbody = html2plaintext(body) File "/srv/modoboa/python-virtualenv-modoboa-1.1.1/local/lib/python2.7/site-packages/modoboa/extensions/webmail/lib.py", line 601, in html2plaintext html = lxml.html.fromstring(content) File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 634, in fromstring doc = document_fromstring(html, parser=parser, base_url=base_url, **kw) File "/usr/lib/python2.7/dist-packages/lxml/html/__init__.py", line 532, in document_fromstring value = etree.fromstring(html, parser, **kw) File "lxml.etree.pyx", line 2754, in lxml.etree.fromstring (src/lxml/lxml.etree.c:54631) File "parser.pxi", line 1578, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:82748) File "parser.pxi", line 1450, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:81481) File "parser.pxi", line 925, in lxml.etree._BaseParser._parseUnicodeDoc (src/lxml/lxml.etree.c:77905) File "parser.pxi", line 569, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:74472) File "parser.pxi", line 650, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:75363) File "parser.pxi", line 599, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:74827) XMLSyntaxError: line 61: htmlParseEntityRef: expecting ';' ```
Author
Owner

@tonioo commented on GitHub (Apr 16, 2014):

What is your lxml version?

<!-- gh-comment-id:40575972 --> @tonioo commented on GitHub (Apr 16, 2014): What is your lxml version?
Author
Owner

@themr0c commented on GitHub (Apr 16, 2014):

lxml==2.3.2

<!-- gh-comment-id:40584844 --> @themr0c commented on GitHub (Apr 16, 2014): lxml==2.3.2
Author
Owner

@tonioo commented on GitHub (Apr 16, 2014):

And what about ckeditor ?

<!-- gh-comment-id:40590278 --> @tonioo commented on GitHub (Apr 16, 2014): And what about ckeditor ?
Author
Owner

@themr0c commented on GitHub (Apr 17, 2014):

last stable version, "custom download" ... so it's a ckeditor issue ?

<!-- gh-comment-id:40723542 --> @themr0c commented on GitHub (Apr 17, 2014): last stable version, "custom download" ... so it's a ckeditor issue ?
Author
Owner

@tonioo commented on GitHub (Apr 17, 2014):

I don't know yet... need to check.

<!-- gh-comment-id:40741060 --> @tonioo commented on GitHub (Apr 17, 2014): I don't know yet... need to check.
Author
Owner

@tonioo commented on GitHub (Apr 17, 2014):

So it looks like a compatibility issue. Can you please test the patch above on your platform?

<!-- gh-comment-id:40745537 --> @tonioo commented on GitHub (Apr 17, 2014): So it looks like a compatibility issue. Can you please test the patch above on your platform?
Author
Owner

@themr0c commented on GitHub (Apr 22, 2014):

it's working, thx.

<!-- gh-comment-id:41023281 --> @themr0c commented on GitHub (Apr 22, 2014): it's working, thx.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#521
No description provided.