Login

Email backend to BCC all emails

Author:
maikhoepfel
Posted:
October 21, 2013
Language:
Python
Version:
Not specified
Score:
0 (after 0 ratings)

The backend lets you quickly get an idea of all emails that are sent out. Helpful for debugging or keeping an archive of all communications. Use instead of Django's SMTPBackend.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from django.core.mail.backends.smtp import EmailBackend

BCC_ADDRESS = '[email protected]'


class BCCEmailBackend(EmailBackend):

    def _send(self, email_message):
        if not email_message.bcc:
            email_message.bcc = [BCC_ADDRESS, ]

        super(BCCEmailBackend, self)._send(email_message)

More like this

  1. Browser-native date input field by kytta 1 month, 1 week ago
  2. Generate and render HTML Table by LLyaudet 1 month, 2 weeks ago
  3. My firs Snippets by GutemaG 1 month, 3 weeks ago
  4. FileField having auto upload_to path by junaidmgithub 3 months ago
  5. LazyPrimaryKeyRelatedField by LLyaudet 3 months, 1 week ago

Comments

Please login first before commenting.