﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13641	The location of the get_connection() function does not correspond with the documentation	caumons	nobody	"If we try to import the get_connection() function from django.core.mail as specified in the documentation we get the following ImportError in Django 1.1.1:
{{{
Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55) 
[GCC 4.4.1] on linux2
Type ""help"", ""copyright"", ""credits"" or ""license"" for more information.
(InteractiveConsole)
>>> from django.core.mail import get_connection
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
ImportError: cannot import name get_connection
}}}
Looking at the source code of the module situated at /usr/local/lib/python2.6/dist-packages/django/core/mail.py we can check that no get_connection() is declared in the module.
If we want to create a connection to send emails, we have to instantiate the SMTPConnection class and then call its methods. For example:
{{{
mailConnection = SMTPConnection()
mailConnection.open()
mailConnection.send_messages([email1, email2])
mailConnection.close()
}}}
get_connection(self, fail_silently=False) is a method inside the EmailMessage class situated in line 228 and used in line 266, not a function.

The solution I see is to update the documentation referring to emails section.
"		closed	Documentation	1.1		invalid	email, connection, get_connection, SMTPConnection		Unreviewed	0	0	0	0	0	0
