Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SMTPAuthenticationError at /kontakt/
- (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')
- EMAIL_HOST = 'smtp.gmail.com'
- EMAIL_HOST_USER = 'mymail@gmail.com'
- EMAIL_HOST_PASSWORD = '********'
- EMAIL_PORT = 587
- EMAIL_USE_TLS = True
- def kontakt(request):
- sent = False
- if request.method == 'POST':
- form = WyslijEmail(request.POST)
- if form.is_valid():
- subject = form.cleaned_data['subject']
- from_email = form.cleaned_data['from_email']
- message = form.cleaned_data['message']
- send_mail(subject, message, from_email,['mymail@gmail.com'])
- sent = True
- else:
- form = WyslijEmail()
- return render(request,'bajki/kontakt.html', {'form':form, 'sent': sent})
- {% if sent %}
- <h1>Wysłano</h1>
- {% else %}
- <h1>Wyslij email</h1>
- <form action="." method="post">
- {% csrf_token %}
- {{ form.as_p }}
- <p><input type="submit" value="Wyślij wiadomość"></p>
- </form>
- {% endif %}
Add Comment
Please, Sign In to add comment