ContactForm

This application allow you to add a very simple contact form on your django project

Download
settings.py

Add the application geelweb.django.contactform to your INSTALLED_APPS

INSTALLED_APPS = (
    ...
    'geelweb.django.contactform'
)

Define some properties

CONTACTFORM_RECIPIENTS = ['guillaume@geelweb.org']
CONTACTFORM_SUBJECT_PREFIX = 'mail from the sandbox '

Configure django.core.mail if not already configured

EMAIL_HOST = 'smtp.example.com'
EMAIL_HOST_USER = 'this-is-my-username'
EMAIL_HOST_PASSWORD = 'and-this-is-my-password'
EMAIL_USE_TLS = True
urls.py

Include the url

urlpatterns = patterns('',
    url(r'^contact$', 'geelweb.django.contactform.views.contact', name='contact'),
)
Html templates

Create two very basic templates

<!-- contactform/contact.html -->

<form action="{% url contact %}" method="post">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="Submit" />
</form>
<!--  contactform/thanks.html -->

<h1>Thanks for your message</h1>
<div>Your message has been sent, we'll try to answer you as quickly as possible.</div>

Finaly add a link to your contact form

<a href="{% url contact %}">Contact</a>
Fork me on GitHub