Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Are you sure the form even submits? Because if you submit a form with debug true, and no csrf token present in your form, Django should give an error. Another idea; you're talking to smtp.gmail.com, but use an @googlemail.com address. Are you sure that copes?</p> <p>EDIT</p> <p>I did this different; instead of using an existing app I build a new one. My app needed to do more than just mailing. And it's only two files, so that should help. I used gmail too, another plus:) I'll give you the relevant code, but cut peaces out, so watch that;)</p> <p>settings.py:</p> <pre><code>from local import localsettings DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Jasper Kennis', 'jasper.kennis@companymail.nl'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': localsettings.db_engine, 'NAME': localsettings.db_name, 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } } SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True # Make this unique, and don't share it with anybody. SECRET_KEY = '###' MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.admin', 'therelevantapp', ) EMAIL_USE_TLS = True EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = '###@gmail.com' EMAIL_HOST_PASSWORD = '###' EMAIL_PORT = 587 </code></pre> <p>and the app, app/views.py</p> <pre><code>import os import os.path import string from random import choice from app.models import * from TitelGenerator.TitelGenerator import TitelGenerator from django import forms from django.conf import settings from django.http import HttpResponse from django.shortcuts import render_to_response from django.template import RequestContext from django.core.mail import send_mail from django.core.mail import EmailMultiAlternatives def klaar(request): if request.method == "POST": title = 'Je inschrijving is voltooid!' message = 'a whole message' send_mail( title , message , 'sendermail' , 'receivermail' , fail_silently=False) return render_to_response('klaar.html' , { 'titel': kind.id, 'request': request.FILES }, context_instance = RequestContext(request)) </code></pre> <p>Note that you REALLY NEED to have {% csrf_token %} inside your form. The form template you'll have to build yourself in this case. Let me know if this helped.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload