Advertisement
Guest User

Untitled

a guest
Sep 4th, 2016
3,327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. EMAIL_HOST = 'smtp.yandex.ru'
  2. EMAIL_HOST_USER = 'my mail'
  3. EMAIL_HOST_PASSWORD = 'password'
  4. EMAIL_PORT = 587
  5. EMAIL_USE_TLS = True
  6.  
  7. def get_data(request):
  8. if request.method == 'POST':
  9. form = MyForm(request.POST)
  10. if form.is_valid():
  11. print('Hi')
  12. e_mail = send_mail('Заказ от {0}'.format(form.name), form.phone_number, 'my mail', ['to mail'])
  13. if e_mail == True:
  14. print(e_mail)
  15. return HttpResponseRedirect('/done/')
  16. else:
  17. return HttpResponse('<h1>Ошибка сообщение не отправлено<h1>')
  18. else:
  19. form = MyForm()
  20. return render(request, 'index.html', {'form':form})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement