def mail(self):
        response = self.cleaned_data.get('response', None)
        topic = self.cleaned_data.get('topic', None)
        email = self.cleaned_data.get('email', None)

        to = [email_tuple[1] for email_tuple in settings.MANAGERS]

        message = render_to_string('feedback/feedback_message.txt', {'email': email, 'topic': topic, 'response': response})

        email_backend(to, message, subject=u'Обратная связь: %s' % topic)
Beispiel #2
0
    def mail(self):
        # prepare context for message
        context = {'fields': {}}
        for name, field in self.fields.iteritems():
            context['fields'][name] = self.cleaned_data.get(name, None)
            # leaved for compatibility. Wil be removed in feedback v 1.2
            context[name] = self.cleaned_data.get(name, None)

        message = render_to_string('feedback/feedback_message.txt', context)

        # generate subject considering settings variable EMAIL_SUBJECT_PREFIX
        subject = settings.EMAIL_SUBJECT_PREFIX + u'feedback'

        # Email backends appears only in Django 1.2
        import django
        if django.VERSION < (1, 2):
            from feedback.utils import email_backend
            email_backend(to, message, subject=self.subject % context)
        else:
            from django.core.mail import mail_managers
            mail_managers(subject, message, fail_silently=False)
    def mail(self):
        # prepare context for message
        context = {"fields": {}}
        for name, field in self.fields.iteritems():
            context["fields"][name] = self.cleaned_data.get(name, None)
            # leaved for compatibility. Wil be removed in feedback v 1.2
            context[name] = self.cleaned_data.get(name, None)

        message = render_to_string("feedback/feedback_message.txt", context)

        # generate subject considering settings variable EMAIL_SUBJECT_PREFIX
        subject = settings.EMAIL_SUBJECT_PREFIX + u"feedback"

        # Email backends appears only in Django 1.2
        import django

        if django.VERSION < (1, 2):
            from feedback.utils import email_backend

            email_backend(to, message, subject=self.subject % context)
        else:
            from django.core.mail import mail_managers

            mail_managers(subject, message, fail_silently=False)