X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/d0f0e1412cc42d366b234e798dfb68feed05d751..d555d988764995ea1f9f5ece46f453a66f09b334:/src/wtem/management/commands/__init__.py diff --git a/src/wtem/management/commands/__init__.py b/src/wtem/management/commands/__init__.py new file mode 100644 index 0000000..e39656a --- /dev/null +++ b/src/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)