First time here? Check out the FAQ!

auth-related outbound email not working (NoneType object has no attribute 'get_text')

Running askbot-devel from github and django 1.4.5.

I've configured SMTP info in and tested my smtp server manually, with the feedback link in askbot and with answer notifications and they seem to work fine.

However, when I sign up a new account or request an account recovery password, I don't get an email and I just see the following in the logs which isn't very helpful or much to go on:

  [Fri May 24 11:16:18 2013] [error] 'NoneType' object has no attribute 'get_text'

That's it. No stack trace and nothing before or after it.

The only get_text I found using grep was in mail/ clean_html_email():

phrases = map(
    lambda s: s.strip(),
    filter(filter_func, body_element.get_text().split('\n'))

Commenting that out didn't work, having DEBUG=True didn't give me any more to go on either. No error occurs in the browser, only in the log, and only that one line.


I've narrowed it down to deps.django_authopenid.views.send_email_key(). When I run this in the shell I get the same error.

askbot.deps.django_authopenid.views.send_email_key('', '12345')

/home/ec2-user/.virtualenvs/askbot/lib/python2.6/site-packages/coffin/ UserWarning: Cannot translate loader: askbot.skins.loaders.Loader
  warnings.warn('Cannot translate loader: %s' % loader)

'NoneType' object has no attribute 'get_text'

I also tested on the current site to try and send a password reset and never got any email so it seems to be broken? Does anyone else have this working?

kporangehat's avatar
asked 2013-05-24 11:46:50 -0500, updated 2013-05-24 14:37:35 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

3 Answers


I had the same problem. It was occurring with BeautifulSoup-4.2.0. I downgraded to BeautifulSoup-4.1.3 (pip install beautifulsoup4==4.1.3) and the problem has gone away. Obviously, this is a temporary solution, but at least I've gotten things to work.

The real problem has to be some quirk in the HTML that is being generated for the email body - when I have a little time, I'll investigate further, and if I find anything useful, I'll post an update.

ngkabra's avatar
answered 2013-06-12 23:01:50 -0500
edit flag offensive 0 remove flag delete link


Thanks for posting this. Unfortunately version compatibility of libraries can be tricky.

Evgeny's avatar Evgeny (2013-06-12 23:41:25 -0500) edit

I confirmed that downgrading beautifulsoup4 to version 4.1.3 has resolved this issue. Thanks @ngkabra. I'm going to play around a bit to see if I can figure out where the root cause actually lie and will update if I find anything.

kporangehat's avatar kporangehat (2013-06-14 13:15:53 -0500) edit

Maybe the incoming HTML does not have the body tag and the new version does stricter parsing?

Evgeny's avatar Evgeny (2013-06-14 13:56:37 -0500) edit

This looks like it was a bug in beautifulsoup4 v4.2.0. I was able to narrow it down to the ampersands used in the title and headline blocks in templates/authopenid/email_validation.html

{% block title %}{% trans %}Greetings from the Q&A forum{% endtrans %},{%endblock%}
{% block headline%}{% trans %}Greetings from the Q&A forum{% endtrans %},{%endblock%}

Removing those solved the issue. I also noticed that they released v4.2.1 recently which also resolves the issue. Looks like it may have been this bug:

All is well now. Thanks everyone for your help and input!

(the 'amp' entities in the code block above got converted. But basically in the template there are literal ampersands)

kporangehat's avatar kporangehat (2013-06-14 14:31:46 -0500) edit
add a comment see more comments

Cannot reproduce this issue in the git repo.

Please change DEBUG setting in the to True, that might help.

Evgeny's avatar
answered 2013-05-25 00:33:39 -0500
edit flag offensive 0 remove flag delete link


I tried DEBUG=True but that didn't change the output. The error is being shown in log/error_log not log/askbot.log.

As far as reproducing... I don't get an email from this site when I try and recover my password. Maybe that could suffice? Not sure where else to look.

kporangehat's avatar kporangehat (2013-05-25 10:30:11 -0500) edit
add a comment see more comments

Looks like your BaseURL is empty or changed, that's why you are not getting email for —New account sign-ups or in requesting an account recovery password.

You need to fill your — "Base URL for your Q&A forum, must start with http or https" setting, goto the Page: that's why your domain and protocol does not shows up.

pajju's avatar
answered 2013-06-13 09:51:05 -0500, updated 2013-06-13 09:54:27 -0500
edit flag offensive 0 remove flag delete link


I already have that field filled in with a FQDN Still get the error. I haven't yet tried downgrading beautifulsoup yet as suggested by @ngkabra but will do that today and report back.

kporangehat's avatar kporangehat (2013-06-13 10:36:06 -0500) edit
add a comment see more comments