

def save(self):
    '\n        Sends the message.\n        '
    subject = self.get_subject()
    from_email = self.get_from_email()
    email_recipients = self.get_email_recipients()
    context = self.get_context()
    message_body = render_to_string(self.get_template_names(), context)
    try:
        message = mail.EmailMultiAlternatives(subject=subject, body=message_body, from_email=from_email, to=email_recipients, headers={
            'Reply-To': self.cleaned_data['email'],
        })
        if settings.USE_HTML_EMAIL:
            html_body = render_to_string(self.html_template_name, context)
            message.attach_alternative(html_body, 'text/html')
        message.send()
        after_send.send(sender=self.__class__, message=message, form=self)
        logger.info((_('Contact form submitted and sent (from: %s)') % self.cleaned_data['email']))
    except SMTPException:
        logger.exception(_('An error occured while sending the email'))
        return False
    else:
        return True

dataset/ETHPy150Open zsiciarz/django-envelope/envelope/forms.py ContactForm.save/original