瀏覽代碼

Structure email creds for easily extend in future

Mohidul Islam 5 年之前
父節點
當前提交
06244f1900
共有 2 個文件被更改,包括 11 次插入4 次删除
  1. 5 1
      review/background_job.py
  2. 6 3
      review_automation/settings.py

+ 5 - 1
review/background_job.py

@@ -2,6 +2,7 @@ import random
 from time import sleep
 from django.utils import timezone
 from gauth.models import Location
+from django.conf import settings
 from analytics.send_email import send_email
 from .models import Review, CustomReply, Reply
 from nlu_job.nlu_utils import is_a_name
@@ -64,7 +65,10 @@ def send_email_bad_reviews():
         reviews = get_bad_reviews(location.location_id, hours=6)
         total_reviews = reviews.count()
         if total_reviews > 0:
-            to = [location.recipient_email if location.recipient_email else 'bt@bytetrek.com.bd']
+            to = settings.ADMIN_MAINTEINER_EMAILS
+            # Add location mainteiner email if it has an email
+            to.append(location.recipient_email) if location.recipient_email else None
+
             subject = f"A bad review has been post in {location.care_name}."
             message =f'''
             <img src="https://ercare24.com/wp-content/uploads/2016/07/signature-care-resized-e1462918690585.png" alt="Avatar" class="image" width=20% >

+ 6 - 3
review_automation/settings.py

@@ -142,9 +142,12 @@ EMAIL_USE_TLS = True
 
 EMAIL_HOST = 'smtp.gmail.com'
 
-EMAIL_HOST_USER = 'your@mail.com'
+EMAIL_HOST_USER = 'webmaster@ercare24.com'
+EMAIL_HOST_PASSWORD = 'Webdev#7182'
 
-# Must generate specific password for your app in [gmail settings][1]
-EMAIL_HOST_PASSWORD = 'y0ur$3cr3tp@$$w0rd'
 
 EMAIL_PORT = 587
+
+ADMIN_MAINTEINER_EMAILS = [
+    'hannan@ercare24.com'
+    ]