From 4d9cc1aea97cd0bd0418227f05ff060839a0b6d5 Mon Sep 17 00:00:00 2001 From: Akshen Date: Mon, 24 Jul 2017 11:54:46 +0530 Subject: Adds separate notification mail of registration for admin --- workshop_app/send_mails.py | 10 ++++++---- workshop_app/views.py | 1 - workshop_portal/settings.py | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/workshop_app/send_mails.py b/workshop_app/send_mails.py index 3f2e7c2..345db8c 100644 --- a/workshop_app/send_mails.py +++ b/workshop_app/send_mails.py @@ -18,7 +18,8 @@ from workshop_portal.settings import ( EMAIL_HOST_PASSWORD, EMAIL_USE_TLS, PRODUCTION_URL, - SENDER_EMAIL + SENDER_EMAIL, + ADMIN_EMAIL ) from django.core.mail import EmailMultiAlternatives from django.conf import settings @@ -126,12 +127,12 @@ def send_email( request, call_on, try: send_mail("New Instructor Registration - FOSSEE, IIT Bombay", - message, SENDER_EMAIL, ['workshops@fossee.in'], + message, SENDER_EMAIL, [ADMIN_EMAIL], fail_silently=False) except Exception: send_smtp_email(request=request, subject="Instructor Registration - FOSSEE, IIT Bombay", - message=message, other_email='workshops@fossee.in', + message=message, other_email=ADMIN_EMAIL, ) else: @@ -151,8 +152,9 @@ def send_email( request, call_on, try: send_mail( "Coordinator Registration at FOSSEE, IIT Bombay", message, SENDER_EMAIL, - [request.user.email, 'workshops@fossee.in'], fail_silently=False + [request.user.email], fail_silently=False ) + except Exception: send_smtp_email(request=request, subject="Coordinator Registration - FOSSEE, IIT Bombay", diff --git a/workshop_app/views.py b/workshop_app/views.py index ffd6185..3446995 100644 --- a/workshop_app/views.py +++ b/workshop_app/views.py @@ -1,4 +1,3 @@ - from .forms import ( UserRegistrationForm, UserLoginForm, ProfileForm, CreateWorkshop, diff --git a/workshop_portal/settings.py b/workshop_portal/settings.py index c0a90df..5379985 100644 --- a/workshop_portal/settings.py +++ b/workshop_portal/settings.py @@ -151,10 +151,13 @@ EMAIL_USE_TLS = EMAIL_USE_TLS EMAIL_TIMEOUT = 300 SENDER_EMAIL = SENDER_EMAIL + #EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' #Temp Solution #Change this to the production url PRODUCTION_URL = 'your_production_url' +ADMIN_EMAIL = 'your admin email' + LOGIN_REDIRECT_URL = '/profile' SESSION_EXPIRE_AT_BROWSER_CLOSE = True -- cgit