Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- form = SendMessageForm(request.POST or None)
- if form.is_valid():
- human = True
- form_message = form.cleaned_data.get("message")
- email = form.cleaned_data.get("email")
- subject = form.cleaned_data.get("subject")
- from_emial = settings.EMAIL_HOST_USER
- to_email = ['##########']
- contact_message = "%s nnfrom %s" %(form_message, email)
- send_mail(subject, contact_message, from_emial, to_email, fail_silently=False)
- return HttpResponseRedirect('/')
- con = {
- "form": form,
- "all_profiles":all_profiles,
- }
- return render(request, "home.html", con)
- DEBUG = True
- ALLOWED_HOSTS = []
- EMAIL_HOST = 'smtp.gmail.com'
- EMAIL_HOST_USER = '#####'
- EMAIL_HOST_PASSWORD = '#####'
- EMAIL_PORT = 587
- EMAIL_USE_TLS = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement