Guest User

Untitled

a guest
Jan 27th, 2018
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. SMTPAuthenticationError at /kontakt/
  2. (535, b'5.7.8 Username and Password not accepted. Learn more atn5.7.8 https://support.google.com/mail/?p=BadCredentials g69sm1490980lji.90 - gsmtp')
  3.  
  4. EMAIL_HOST = 'smtp.gmail.com'
  5. EMAIL_HOST_USER = 'mymail@gmail.com'
  6. EMAIL_HOST_PASSWORD = '********'
  7. EMAIL_PORT = 587
  8. EMAIL_USE_TLS = True
  9.  
  10. def kontakt(request):
  11. sent = False
  12. if request.method == 'POST':
  13. form = WyslijEmail(request.POST)
  14. if form.is_valid():
  15. subject = form.cleaned_data['subject']
  16. from_email = form.cleaned_data['from_email']
  17. message = form.cleaned_data['message']
  18. send_mail(subject, message, from_email,['mymail@gmail.com'])
  19. sent = True
  20. else:
  21. form = WyslijEmail()
  22. return render(request,'bajki/kontakt.html', {'form':form, 'sent': sent})
  23.  
  24. {% if sent %}
  25. <h1>Wysłano</h1>
  26. {% else %}
  27. <h1>Wyslij email</h1>
  28. <form action="." method="post">
  29. {% csrf_token %}
  30. {{ form.as_p }}
  31. <p><input type="submit" value="Wyślij wiadomość"></p>
  32. </form>
  33. {% endif %}
Add Comment
Please, Sign In to add comment