Commits

rtissot committed 4ca0b39

add a setting to allow activation emails to be send in copy to the email of your choice.

Comments (0)

Files changed (2)

docs/default-backend.rst

     is optional, and a default of ``True`` will be assumed if it is
     not supplied.
 
+``ACCOUNT_ACTIVATION_EMAIL_BCC``
+   A list of tuples containing the name and address of the people
+   who should receive a copy of every activation mail sent. 
+
 By default, this backend uses
 :class:`registration.forms.RegistrationForm` as its form class for
 user registration; this can be overridden by passing the keyword

registration/models.py

 from django.db import transaction
 from django.template.loader import render_to_string
 from django.utils.translation import ugettext_lazy as _
+from django.core.mail import EmailMessage
 
 try:
     from django.utils.timezone import now as datetime_now
         """
         Send an activation email to the user associated with this
         ``RegistrationProfile``.
-        
+
         The activation email will make use of two templates:
 
         ``registration/activation_email_subject.txt``
 
         ``user``
             The User object associated with the RegistrationProfile.
-            
+
         """
         ctx_dict = {'activation_key': self.activation_key,
                     'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
                                    ctx_dict)
         # Email subject *must not* contain newlines
         subject = ''.join(subject.splitlines())
-        
+
         message = render_to_string('registration/activation_email.txt',
                                    ctx_dict)
-        
-        self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
-    
+
+        bcced = [email for nick, email in getattr(settings, 'ACCOUNT_ACTIVATION_EMAIL_BCC', [])]
+        EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL, [self.user.email,], [bcced]).send()