Esempio n. 1
0
def sendmail(request):
    if request.POST:
        form = EmailForm(request.POST)
        if form.is_valid():
            firstname = form.cleaned_data['firstname']
            lastname = form.cleaned_data['lastname']
            email = form.cleaned_data['email']
            subject = form.cleaned_data['subject']
            message = form.cleaned_data['message']
            try:
                send_mail('subject', 'message', '<SENDER EMAIL ID>',
                          ['<RECEIVER EMAIL ID"S>'])
                return HttpResponseRedirect('/email/thankyou/')
            except Exception, e:
                return HttpResponse('Except Block executed.' + str(e))
        else:
            return HttpResponse("Form not Valid")
Esempio n. 2
0
File: views.py Progetto: kmax12/lts
def get_email(request):
    post = request.POST
    form = EmailForm()
    if post:
        form = EmailForm(post)
        if form.is_valid():
            request.session['email'] = form.cleaned_data["email"]
            cart = Cart(request)
            cart.cart.email = form.cleaned_data["email"]
            cart.cart.save()
            print request.GET.get('next', '/')
            return HttpResponseRedirect(request.GET.get('next', '/'))

    template_values = {
        'form' : form
    }
    return direct_to_template(request, 'get_email.html', template_values)
Esempio n. 3
0
def sendmail(request):
      if request.method == 'POST':
        form = EmailForm(request.POST)
        if form.is_valid():
			  firstname = form.cleaned_data['firstname']
			  lastname = form.cleaned_data['lastname']
			  email = form.cleaned_data['email']
			  subject = form.cleaned_data['subject']
			  botcheck = form.cleaned_data['botcheck']
			  message = form.cleaned_data['message']
			  area = form.cleaned_data['area']
			  if botcheck :
				try:
				  fullemail = firstname + " " + lastname + " " + "<" + email + ">"
				  send_mail(subject, message, fullemail, ['*****@*****.**'])
				  return HttpResponseRedirect('/contact/thankyou/')
				except:
				  return HttpResponseRedirect('/contact/')
        else:
          return HttpResponseRedirect('/contact/')
      else:
        return HttpResponseRedirect('/contact/')
Esempio n. 4
0
def sendmail(request):
    if request.method == 'POST':
        form = EmailForm(request.POST)
        if form.is_valid():
            firstname = form.cleaned_data['firstname']
            lastname = form.cleaned_data['lastname']
            email = form.cleaned_data['email']
            subject = form.cleaned_data['subject']
            botcheck = form.cleaned_data['botcheck']
            message = form.cleaned_data['message']
            area = form.cleaned_data['area']
            if botcheck:
                try:
                    fullemail = firstname + " " + lastname + " " + "<" + email + ">"
                    send_mail(subject, message, fullemail,
                              ['*****@*****.**'])
                    return HttpResponseRedirect('/contact/thankyou/')
                except:
                    return HttpResponseRedirect('/contact/')
        else:
            return HttpResponseRedirect('/contact/')
    else:
        return HttpResponseRedirect('/contact/')