title: send_email() takes 1 positional argument but 3 were given - Django Python
body: <p>I am trying to send a test email from my Django python project and following the django docs for that. When the below function is executed I get an error (image attached). What I am doing wrong?</p>
  
  <p><a href="https://docs.djangoproject.com/en/2.0/topics/email/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/2.0/topics/email/</a></p>
  
  <pre><code>from django.core.mail import send_mail, BadHeaderError
  from django.http import HttpResponse, HttpResponseRedirect
  
      def send_email(request):
          subject = request.POST.get('subject', 'Test')
          message = request.POST.get('message', 'Test Message')
          from_email = request.POST.get('from_email', 'test@example.com')
          if subject and message and from_email:
              try:
                  send_mail(subject, message, from_email, ['admin@example.com'])
              except BadHeaderError:
                  return HttpResponse('Invalid header found.')
              return HttpResponseRedirect('/contact/thanks/')
          else:
              # In reality we'd use a form class
              # to get proper validation errors.
              return HttpResponse('Make sure all fields are entered and valid.')
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/H3ZfH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H3ZfH.png" alt="enter image description here"></a></p>
  
  <p><strong>Traceback:</strong> 
  I am adding a Traceback as well to clarify my question. Hope it helps</p>
  
  <pre><code>File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
    35.             response = get_response(request)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
    128.                 response = self.process_exception_by_middleware(e, request)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
    126.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/contrib/admin/options.py" in wrapper
    574.                 return self.admin_site.admin_view(view)(*args, **kwargs)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
    142.                     response = view_func(request, *args, **kwargs)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
    44.         response = view_func(request, *args, **kwargs)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/contrib/admin/sites.py" in inner
    223.             return view(request, *args, **kwargs)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
    62.             return bound_func(*args, **kwargs)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
    142.                     response = view_func(request, *args, **kwargs)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/utils/decorators.py" in bound_func
    58.                 return func.__get__(self, type(self))(*args2, **kwargs2)
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/contrib/admin/options.py" in changelist_view
    1596.                 response = self.response_action(request, queryset=cl.get_queryset(request))
  
  File "/home/jimtiaz/PycharmProjects/TestAoo/venv/lib/python3.6/site-packages/django/contrib/admin/options.py" in response_action
    1330.             response = func(self, request, queryset)
  
  Exception Type: TypeError at /admin/home/something
  Exception Value: send_email() takes 1 positional argument but 3 were given
  </code></pre>