X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/b154d06ff9d6b7fa711607bc02d03fb9db5c6d33..b5f4c5802e803b17be080917765e4ea6646eadb7:/wtem/management/commands/__init__.py?ds=sidebyside

diff --git a/wtem/management/commands/__init__.py b/wtem/management/commands/__init__.py
index e69de29..e39656a 100644
--- a/wtem/management/commands/__init__.py
+++ b/wtem/management/commands/__init__.py
@@ -0,0 +1,17 @@
+from django.core.mail import EmailMessage
+from django.conf import settings
+
+def send_mail(subject, body, to):
+    if not isinstance(to, list):
+        to = [to]
+
+    reply_to = getattr(settings, 'WTEM_REPLY_TO', None)
+    headers = dict()
+    if reply_to:
+        headers['Reply-To'] = reply_to
+
+    email = EmailMessage(subject, body,
+        getattr(settings, 'WTEM_FROM', 'edukacjamedialna@nowoczesnapolska.org.pl'),
+        to, headers = headers)
+    #print email.message()
+    email.send(fail_silently = False)