I am deploying a django project and my contact form is stopped. I tried to find some hints on the stack, but this does not work, help me plz.
Here are my local settings:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_HOST_USER = ' mymail@gmail.com ' EMAIL_HOST_PASSWORD = 'password'
and my opinion:
def contact_form(request): form = ContactForm(request.POST or None) if form.is_valid(): message = form.cleaned_data.get('message') email = form.cleaned_data.get('email') subject = 'contact form' from_email = email to_email = (settings.EMAIL_HOST_USER,) contact_message = '%s, from %s' %(message, from_email) send_mail(subject, contact_message, from_email, to_email, fail_silently=False) form = ContactForm() request.session.set_expiry(10) request.session['pause'] = True return render(request, 'contact_form.html', {'form':form})
Now, when I send a message, I have an "Internal Server Error".
source share