def test_mail(request): subject = 'Some Test Message' message = 'This is a message!' html = '<strong>This</strong> is a message!' sender = 'testing@localhost' email = create_email(subject, message, html, from_email=sender) email.to = ['hardcoded-email-address@localhost'] email.send() return render(request, 'test_email.html')
def _receipt(request, petition_id, subject, message, html=None): sender = settings.INSTANCE_NOREPLY_EMAIL recipients = [request.user.email] try: email = create_email(subject, message, html, from_email=sender) email.to = recipients email.send() except Exception as e: c = {'e': e} return render(request, 'petition/receipt_error.html', c) return HttpResponseRedirect(reverse('detail', args=(petition_id, )))