Opened 5 years ago

Closed 5 years ago

#13685 closed (fixed)

get_connection() fails to initialize

Reported by: Alex Owned by: nobody
Component: Documentation Version: 1.2
Severity: Keywords: get_connection
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by kmtracey)

> from django.core import mail

> connection = mail.get_connection(backend="django.core.mail.backends.smtp")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/alwaysdata/python/django/1.2.1/django/core/mail/", line 41, in get_connection
    return klass(fail_silently=fail_silently, **kwds)
TypeError: 'module' object is not callable

Change History (4)

comment:1 Changed 5 years ago by kmtracey

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Shouldn't that be:

>>> from django.core import mail
>>> connection = mail.get_connection(backend="django.core.mail.backends.smtp.EmailBackend")
>>> connection
<django.core.mail.backends.smtp.EmailBackend object at 0x013F18D0>


I would expect to pass in the same as what the default setting value is: that seems to work fine.

comment:2 Changed 5 years ago by Alex

The documentation says it should be "django.core.mail.backends.smtp" by default:

That was confusing for me.

I removed
EMAIL_BACKEND = 'django.core.mail.backends.smtp'
from and the problem has gone

comment:3 Changed 5 years ago by kmtracey

  • Component changed from django.core.mail to Documentation
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Triage Stage changed from Unreviewed to Accepted

So the settings doc is wrong and needs to be corrected.

comment:4 Changed 5 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [13316]) Fixed #13685: Correct the default value for EMAIL_BACKEND listed in the settings ref.

Note: See TracTickets for help on using tickets.
Back to Top