diff --git a/lms/djangoapps/student/views.py b/lms/djangoapps/student/views.py index a157da7bef..880eb9cd1f 100644 --- a/lms/djangoapps/student/views.py +++ b/lms/djangoapps/student/views.py @@ -191,7 +191,9 @@ def create_account(request, post_override=None): up.save() d={'name':post_vars['name'], - 'key':r.activation_key} + 'key':r.activation_key, + 'course_title' : settings.COURSE_TITLE, + } subject = render_to_string('emails/activation_email_subject.txt',d) # Email subject *must not* contain newlines @@ -199,7 +201,11 @@ def create_account(request, post_override=None): message = render_to_string('emails/activation_email.txt',d) try: - if not settings.GENERATE_RANDOM_USER_CREDENTIALS: + if settings.MITX_FEATURES.get('REROUTE_ACTIVATION_EMAIL',''): + dest_addr = settings.MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] + message = "Activation for %s (%s): %s\n" % (u,u.email,up.name) + '-'*80 + '\n\n' + message + send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [dest_addr], fail_silently=False) + elif not settings.GENERATE_RANDOM_USER_CREDENTIALS: res=u.email_user(subject, message, settings.DEFAULT_FROM_EMAIL) except: log.exception(sys.exc_info()) diff --git a/lms/envs/common.py b/lms/envs/common.py index 60834f9d91..06469a3839 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -38,6 +38,7 @@ MITX_FEATURES = { 'SAMPLE' : False, 'USE_DJANGO_PIPELINE' : True, 'DISPLAY_HISTOGRAMS_TO_STAFF' : True, + 'REROUTE_ACTIVATION_EMAIL' : False, # nonempty string = address for all activation emails } # Used for A/B testing diff --git a/lms/envs/dev_edx4edx.py b/lms/envs/dev_edx4edx.py index 2c4b2a53e7..741bdf9127 100644 --- a/lms/envs/dev_edx4edx.py +++ b/lms/envs/dev_edx4edx.py @@ -24,6 +24,7 @@ if 'eecs1' in socket.gethostname(): # edx4edx content server EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'ichuang@mit.edu' #EMAIL_BACKEND = 'django_ses.SESBackend' #----------------------------------------------------------------------------- diff --git a/lms/envs/dev_ike.py b/lms/envs/dev_ike.py index ad0380b3cc..df09ba2dc3 100644 --- a/lms/envs/dev_ike.py +++ b/lms/envs/dev_ike.py @@ -24,6 +24,8 @@ if 'eecs1' in socket.gethostname(): # edx4edx content server EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +MITX_FEATURES['REROUTE_ACTIVATION_EMAIL'] = 'ichuang@mit.edu' + #EMAIL_BACKEND = 'django_ses.SESBackend' #----------------------------------------------------------------------------- diff --git a/lms/templates/emails/activation_email.txt b/lms/templates/emails/activation_email.txt index 2bd26c9fb7..4343da37f8 100644 --- a/lms/templates/emails/activation_email.txt +++ b/lms/templates/emails/activation_email.txt @@ -1,7 +1,7 @@ Someone, hopefully you, signed up for an account for MITx's on-line -offering of 6.002 using this email address. If it was you, and you'd -like to activate and use your account, copy and paste this address -into your web browser's address bar: +offering of "${ course_title}" using this email address. If it was +you, and you'd like to activate and use your account, copy and paste +this address into your web browser's address bar: % if is_secure: https://${ site }/activate/${ key }