def send_email(request): form = BulkEmailForm(request.POST or None) if request.method == 'POST': if form.is_valid(): subject = form.cleaned_data['subject'] body = form.cleaned_data['body'] person_query = form.get_person_query() emails = _get_emails(person_query, subject, body) if 'preview' in request.POST: try: preview = emails[0] except IndexError: preview = None else: send_mass_mail(emails) messages.success(request, "Emails sent successfully") return HttpResponseRedirect(reverse('index')) return render(template_name='karaage/emails/send_email_form.html', context=locals(), request=request)
def send_email(request): form = BulkEmailForm(request.POST or None) if request.method == 'POST': if form.is_valid(): subject = form.cleaned_data['subject'] body = form.cleaned_data['body'] person_query = form.get_person_query() emails = _get_emails(person_query, subject, body) if 'preview' in request.POST: try: preview = emails[0] except IndexError: preview = None else: send_mass_mail(emails) messages.success(request, "Emails sent successfully") return HttpResponseRedirect(reverse('index')) return render( template_name='karaage/emails/send_email_form.html', context=locals(), request=request)
def send_email(request): form = BulkEmailForm(request.POST or None) if request.method == 'POST': if form.is_valid(): if 'preview' in request.POST: emails = form.get_emails() try: preview = emails[0] except: pass else: send_mass_mail(form.get_emails()) messages.success(request, "Emails sent successfully") return HttpResponseRedirect(reverse('index')) return render_to_response('emails/send_email_form.html', locals(), context_instance=RequestContext(request))
def send_email(request): form = BulkEmailForm(request.POST or None) if request.method == 'POST': if form.is_valid(): if 'preview' in request.POST: emails = form.get_emails() try: preview = emails[0] except IndexError: pass else: send_mass_mail(form.get_emails()) messages.success(request, "Emails sent successfully") return HttpResponseRedirect(reverse('index')) return render_to_response('karaage/emails/send_email_form.html', locals(), context_instance=RequestContext(request))
def send_email(request): form = BulkEmailForm(request.POST or None) if request.method == 'POST': if form.is_valid(): if 'preview' in request.POST: emails = form.get_emails() try: preview = emails[0] except IndexError: pass else: send_mass_mail(form.get_emails()) messages.success(request, "Emails sent successfully") return HttpResponseRedirect(reverse('index')) return render( template_name='karaage/emails/send_email_form.html', context=locals(), request=request)