Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- error: [Errno 111] Connection refused
- def contact(request):
- if request.method == 'POST':
- form = EmailForm(request.POST)
- if form.is_valid():
- mail = form.cleaned_data
- send_mail(
- 'Automated Enquiry',
- 'A user is interested in part ' + mail['part'] + '.Their message: ' + mail['msg'],
- mail['email'],
- ['myemail@gmail.com'],
- fail_silently = False,
- )
- return render(request, 'manager/error.html', {'msg': "Thanks, we will be in touch as soon as possible"})
- else:
- part = request.GET.get('part', '')
- form = EmailForm()
- return render(request, 'manager/contact.html', {'form': form, 'part':part})
- EMAIL_HOST = 'smtp.sendgrid.net'
- EMAIL_HOST_USER = 'myuser'
- EMAIL_HOST_PASSWORD = 'mypassword'
- EMAIL_PORT = 587
- EMAIL_USE_TLS = True
Add Comment
Please, Sign In to add comment