title: EmailMultiAlternatives no connection could be made because the target machine actively refused it
body: <p>I'm trying to make an ajax request to will generate a password for a user and send them an email with the password. This all works fine, except for the error I'm getting at <code>msg.send()</code></p>
  
  <p>Ajax:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          var frm = $('#retrieveKeyForm');
  
              frm.submit(function (e) {
  
                  e.preventDefault();
  
                  $.ajax({
                      type: frm.attr('method'),
                      url: frm.attr('action'),
                      data: frm.serialize(),
                      success: function (data) {
                          console.log('Submission was successful.');
                      },
                      error: function (data) {
                          console.log('An error occurred.');
                          console.log(data);
                      },
                  });
              });
          &lt;/script&gt;
  </code></pre>
  
  <p>Views.py</p>
  
  <pre><code>    class GenerateSecretKey(APIView):
          def get(self, request):
      #Get email address from request
              emailaddr = request.GET.get('email')
              print(emailaddr)
  #Show the email address(for debugging)
              min_char = 10
              max_char = 12
              allchar = string.ascii_letters + string.digits
  #Generate passsword
              password = "".join(choice(allchar) for x in range(randint(min_char, max_char)))
              print("Your password is {}".format(password))
  
              subject, from_email, to = 'Your key is ready!', 'test@test.com', emailaddr
              html_content = render_to_string('testapp/email.html', {'password':password})
              text_content = strip_tags(html_content) 
              msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
              msg.attach_alternative(html_content, "text/html")
              msg.send()
              return Response({'Success':'Your key has been generated. Please check your email.'})
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
  </code></pre>