title: Mail function doesn't send mail in Django
body: <p>I wrote code in basic HTML tags like and there was no problem. Mail was sent correctly. But when I changed its place and HTML tags mail function didn't work. What problem can be?</p>
  
  <p>It works</p>
  
  <pre><code>&lt;h1&gt;Contact Us&lt;/h1&gt;
  &lt;form method="post"&gt;
      {% csrf_token %}
      {{ form.as_p }}
      &lt;div class="form-actions"&gt;
        &lt;button type="submit"&gt;Send&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>It doesn't work.</p>
  
  <pre><code>&lt;form class="contact-form" action="" method="GET"&gt;
      {% csrf_token %}
      {% for field in form %}
      {{ field|add_class:"input" }}            
      {% endfor %}
      &lt;button class="button" type="submit"&gt;Send&lt;/button&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def index(request):
      if request.method == 'GET':
          form = ContactForm()
      else:
          form = ContactForm(request.POST or None)
          if form.is_valid():
              fullname = form.cleaned_data['fullname']
              from_email = form.cleaned_data['from_email']
              message = form.cleaned_data['message']
              try:
                  send_mail(fullname, message, from_email, 
                             ['gulnarnecefova1996@gmail.com'])
              except BadHeaderError:
                  return HttpResponse('Invalid header found.')
              return redirect('home')
      context['form'] = form
      return render(request, "index.html", context)
  </code></pre>