daily pastebin goal
91%
SHARE
TWEET

Untitled

a guest Oct 17th, 2017 374 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. error: [Errno 111] Connection refused
  2.    
  3. def contact(request):
  4.     if request.method == 'POST':
  5.         form = EmailForm(request.POST)
  6.  
  7.         if form.is_valid():
  8.             mail = form.cleaned_data
  9.  
  10.             send_mail(
  11.                 'Automated Enquiry',
  12.                 'A user is interested in part ' + mail['part'] + '.Their message: ' + mail['msg'],
  13.                 mail['email'],
  14.                 ['myemail@gmail.com'],
  15.                 fail_silently = False,
  16.             )
  17.  
  18.             return render(request, 'manager/error.html', {'msg': "Thanks, we will be in touch as soon as possible"})
  19.  
  20.     else:
  21.         part = request.GET.get('part', '')
  22.         form = EmailForm()
  23.  
  24.     return render(request, 'manager/contact.html', {'form': form, 'part':part})
  25.    
  26. EMAIL_HOST = 'smtp.sendgrid.net'
  27. EMAIL_HOST_USER = 'myuser'
  28. EMAIL_HOST_PASSWORD = 'mypassword'
  29. EMAIL_PORT = 587
  30. EMAIL_USE_TLS = True
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top