X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/4e59794ba74181bff1f15a205f48c51d9785e07f..130e1c7f8c43261d0e85e5ff9a354f037bb7cd24:/wtem/management/commands/__init__.py diff --git a/wtem/management/commands/__init__.py b/wtem/management/commands/__init__.py index e69de29..494edb6 100644 --- a/wtem/management/commands/__init__.py +++ b/wtem/management/commands/__init__.py @@ -0,0 +1,16 @@ +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) + email.send(fail_silently = False) \ No newline at end of file