|
|
|
|
@ -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'] |
|
|
|
|
) |
|
|
|
|
|