Changes between Initial Version and Version 1 of Ticket #13641
- Timestamp:
- May 27, 2010, 3:25:24 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #13641
- Property Resolution → invalid
- Property Status new → closed
-
Ticket #13641 – Description
initial v1 1 1 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: 2 2 {{{ 3 3 Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55) 4 4 [GCC 4.4.1] on linux2 … … 9 9 File "<console>", line 1, in <module> 10 10 ImportError: cannot import name get_connection 11 11 }}} 12 12 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. 13 13 If we want to create a connection to send emails, we have to instantiate the SMTPConnection class and then call its methods. For example: 14 14 {{{ 15 15 mailConnection = SMTPConnection() 16 16 mailConnection.open() 17 17 mailConnection.send_messages([email1, email2]) 18 18 mailConnection.close() 19 19 }}} 20 20 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. 21 21