new emails
[edumed.git] / wtem / management / commands / __init__.py
1 from django.core.mail import EmailMessage
2 from django.conf import settings
3
4
5 def send_mail(subject, body, to):
6     if not isinstance(to, list):
7         to = [to]
8
9     reply_to = getattr(settings, 'WTEM_REPLY_TO', None)
10     headers = dict()
11     if reply_to:
12         headers['Reply-To'] = reply_to
13
14     email = EmailMessage(subject, body,
15         getattr(settings, 'WTEM_FROM', 'olimpiada@nowoczesnapolska.org.pl'),
16         to, headers = headers)
17     #print email.message()
18     email.send(fail_silently = False)