From 591046a907e7ebd054d0dfc3c5a8844426177628 Mon Sep 17 00:00:00 2001
From: dcz <dcz@ipipan.waw.pl>
Date: Tue, 5 Sep 2023 16:41:21 +0200
Subject: [PATCH] email service configuration

---
 .environment-dev | 13 +++++++------
 users/utils.py   |  4 +++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/.environment-dev b/.environment-dev
index 28431a5..7483545 100644
--- a/.environment-dev
+++ b/.environment-dev
@@ -5,12 +5,13 @@ DATABASE_PASSWORD=shellvalier
 DATABASE_PORT=5432
 DATABASE_USER=shellvalier
 DEBUG=true
-EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
-EMAIL_HOST=
-EMAIL_PORT=25
-EMAIL_HOST_USER=
-EMAIL_HOST_PASSWORD=
-EMAIL_USE_TLS=false
+EMAIL_FROM=valunifier@ipipan.waw.pl
+EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
+EMAIL_HOST=zimbra.ipipan.waw.pl
+EMAIL_PORT=587
+EMAIL_HOST_USER=valunifier
+EMAIL_HOST_PASSWORD=gE7ds6hbGLGHRwm4
+EMAIL_USE_TLS=true
 EMAIL_USE_SSL=false
 SECRET_KEY=Ixosoh1iemoh0Heloh1thee5akooboonu5veehae4aikoh2ohg
 UWSGI_PROCESS_PER_CONTAINER=4
diff --git a/users/utils.py b/users/utils.py
index ae63178..959ba1c 100644
--- a/users/utils.py
+++ b/users/utils.py
@@ -2,6 +2,8 @@ from django.core.mail import send_mail
 from django.utils.translation import gettext as _
 from django.template import loader
 
+from shellvalier.environment import get_environment
+
 
 def send_new_user_email(site, user, use_https):
     subject = _('Zaproszenie do %s') % (site.name, )
@@ -11,4 +13,4 @@ def send_new_user_email(site, user, use_https):
         'domain': site.domain,
         'user': user,
     })
-    send_mail(subject, body, from_email=None, recipient_list=[user.email])
+    send_mail(subject, body, from_email=get_environment('EMAIL_FROM', default=None), recipient_list=[user.email])
-- 
GitLab