add sending logic to contact us mixin

remotes/origin/HEAD
Max Yakovenko 8 years ago
parent c993b4f571
commit d50db7b73a
  1. 39
      contact_us/mixins.py

@ -1,3 +1,4 @@
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy as _
@ -21,38 +22,8 @@ class RequestNotifiable(object):
:param template_path string:
:return None:
"""
notification = self.get_mail_template(
slug=self.SLUG_NOTIFICATION,
)
kwargs = {
'subject': _('New contact us request'),
'message': get_template('contact_us/contact_email_notification.html').template.source,
}
if not notification:
kwargs.update({
'name': 'Admin notification',
'slug': self.SLUG_NOTIFICATION,
'num_of_retries': 3,
'is_html': True
})
# MailTemplate.objects.create(**kwargs)
else:
notification.subject = kwargs.get('subject')
notification.message = kwargs.get('message')
notification.save()
# send_db_mail(
# self.SLUG_NOTIFICATION,
# context.get('recipients'),
# context.get('subject'),
# context.get('context'),
# from_email=context.get('from_email', tuple()),
# bcc=context.get('bcc', tuple()),
# files=context.get('files', tuple()),
# send_at_date=context.get('send_at_date'),
# retry=True,
# retry_delay=300,
# max_retries=3,
# use_celery=celery_supported()
# )
email = EmailMultiAlternatives(
context['subject'],'body',context['from_email'],
context['recipients'],context['bcc']
)

Loading…
Cancel
Save