Advertisement
Guest User

Untitled

a guest
Feb 8th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. #settings
  2. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  3. EMAIL_HOST_USER = '---'
  4. EMAIL_HOST_USERNAME = ''
  5. EMAIL_HOST_PASSWORD = ''
  6. EMAIL_PORT = 25
  7. EMAIL_USE_TLS = False
  8.  
  9. def contact(request):
  10. title = "Content"
  11. form = contactForm(request.POST or None)
  12.  
  13. context = {'title': title, 'form': form,}
  14.  
  15. if form.is_valid():
  16. name = form.cleaned_data['name']
  17. comment = form.cleaned_data['comment']
  18.  
  19. subject = "Thanks"
  20. message = "%s %s" % (comment, name)
  21. emailTo = [form.cleaned_data['email']]
  22. emailFrom = settings.EMAIL_HOST_USER
  23. send_mail(
  24. subject,
  25. message,
  26. emailFrom,
  27. emailTo,
  28. fail_silently=False,
  29. )
  30. title = "Thanks"
  31. confirm_message = "Thanks for the message. We will get right back to you."
  32.  
  33. template = "contact.html"
  34. return render(request,template,context)
  35.  
  36. -------------------------------------------------------------------------------
  37. [08/Feb/2017 07:53:13] "POST /contact/ HTTP/1.1" 200 7666
  38. MIME-Version: 1.0
  39. Content-Type: text/plain; charset="utf-8"
  40. Content-Transfer-Encoding: 7bit
  41. Subject: #subject
  42. From: #host address
  43. To: #receiver address
  44. Date: Wed, 08 Feb 2017 07:53:20 -0000
  45. Message-ID: <-----.----.---- @natiq-macbook-pro.local>
  46.  
  47. # Message
  48. -------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement