Getting error 403 (CSRF token missing or incorrect)
<p>I'm need some email form and I'm trying this:</p>

<p>views.py</p>

<pre><code>def send_email(request):
    if request.method != 'POST':
        form = EmailForm()
        return render_to_response('mail_form.html', {'email_form': form})

    form = EmailForm(request.POST, request.FILES)   
    if form.is_valid():
        subject = form.cleaned_data['subject']
        message = form.cleaned_data['message']
        email = form.cleaned_data['email']
        attach = request.FILES['attach']
        try:
            mail = EmailMessage(subject, message, settings.EMAIL_HOST_USER, [email])
            mail.attach(attach.name, attach.read(), attach.content_type)
            mail.send()
            return render(request, 'mail_form.html', {'message': 'Sent email to %s'%email})
        except:
            return render(request, 'mail_form.html', {'message': 'Either the attachment is too  big or corrupt'})
        return render(request, 'mail_form.html', {'message': 'Unable to send email. Please try again later'})
</code></pre>

<p>forms.py</p>

<pre><code>class EmailForm(forms.Form):
    email = forms.EmailField()
    subject = forms.CharField(max_length=100)
    attach = forms.Field(widget=forms.FileInput)
    message = forms.CharField(widget = forms.Textarea)
</code></pre>

<p>mail_form.html</p>

<pre><code>...
{{message}}
&lt;form method="post" action=""&gt;
    {% csrf_token %}
    {{ email_form.as_p }}
    &lt;input type ="submit"  name = "send" value = "Send"/&gt;
&lt;/form&gt;
...
</code></pre>

<p>But constantly I get an error 403. I tried different solutions from the web, but nothing helped. What I'm doing wrong? I'm understand that something wrong with csrf in views.py, but don't understand where is the problem concretely.</p>