+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
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
-from django.core.mail import send_mail
+from wtem.management.commands import send_mail
from django.template.loader import render_to_string
from contact.models import Contact
def send_message(self, message, subject, email):
self.stdout.write('>>> sending to %s' % email)
send_mail(
- subject,
- message,
- getattr(settings, 'WTEM_CONTACT_EMAIL', 'no-reply@edukacjamedialna.edu.pl'),
- [email],
- fail_silently=False
+ subject = subject,
+ body = message,
+ to = [email]
)
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
-from django.core.mail import send_mail
+from wtem.management.commands import send_mail
from django.template.loader import render_to_string
from wtem.models import Submission, DEBUG_KEY
def send_key(self, submission):
self.stdout.write('>>> sending to ' + submission.email)
send_mail(
- "WTEM - Twój link do zadań",
- render_to_string('wtem/email_key.txt', dict(submission = submission)),
- getattr(settings, 'WTEM_CONTACT_EMAIL', 'no-reply@edukacjamedialna.edu.pl'),
- [submission.email],
- fail_silently=False
+ subject = "WTEM - Twój link do zadań",
+ body = render_to_string('wtem/email_key.txt', dict(submission = submission)),
+ to = [submission.email]
)
\ No newline at end of file