title: Testing Django email backend
body: <p>In my settings.py, I put:</p>
  
  <pre><code>EMAIL_BACKEND = 'mailer.backend.DbBackend'
  </code></pre>
  
  <p>So even when importing from <code>from django.core.mail import send_mail</code>, the <code>send_mail</code> function still queues up the email in the database instead of sending it immediately.</p>
  
  <p>It works just fine when actually running the website, but when testing the website, and accessing some webpages that trigger emails, emails are no longer queued anymore:</p>
  
  <pre><code>def test_something(self):
      ...
      # Check no emails are actually sent yet
      self.assertEquals(len(mail.outbox), 0) # test fails here -- 2 != 0
  
      # Check queued emails.
      messages = Message.objects.all()
      self.assertEquals(messages.count(), 2) # test would also fail here -- 0 != 2
      ...
  </code></pre>
  
  <p>How come it doesn't seem to be using the backend when it is testing? (importing <code>send_mail</code> from <code>mailer</code> itself gets the tests to pass, but I can't really change the imports of other mailing apps like <code>django-templated-email</code>)</p>