Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EMAIL_HOST = 'smtp.yandex.ru'
- EMAIL_HOST_USER = 'my mail'
- EMAIL_HOST_PASSWORD = 'password'
- EMAIL_PORT = 587
- EMAIL_USE_TLS = True
- def get_data(request):
- if request.method == 'POST':
- form = MyForm(request.POST)
- if form.is_valid():
- print('Hi')
- e_mail = send_mail('Заказ от {0}'.format(form.name), form.phone_number, 'my mail', ['to mail'])
- if e_mail == True:
- print(e_mail)
- return HttpResponseRedirect('/done/')
- else:
- return HttpResponse('<h1>Ошибка сообщение не отправлено<h1>')
- else:
- form = MyForm()
- return render(request, 'index.html', {'form':form})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement