How to send POST data with AJAX? And how to get POST data in Web API?
<p>On my MVC project I have to send a HTML table as an email to the client.</p>

<p>I have an Email Function on a Web API that I should call:</p>

<pre><code>public class FunctionsController : ApiController
{
    [HttpPost]
    [Route("{controller}/email")]
    public void SendEmail(string to, string from, string body, string subject, string bcc)
    {
        SmtpClient smtpClient = new SmtpClient();
        smtpClient.Host = "xxxx";
        MailMessage mailMessage = new MailMessage();

        mailMessage.IsBodyHtml = true;
        mailMessage.Body = body;
        mailMessage.Subject = subject;
        mailMessage.From = new MailAddress(from);
        mailMessage.To.Add(new MailAddress(to));
        mailMessage.Bcc.Add(new MailAddress(bcc));

        smtpClient.Send(mailMessage);
    }
</code></pre>

<p>I'm not sure how to do it.</p>

<p>This is my sendEmail javascript function on my MVC project (using Knockout):</p>

<pre><code>   self.sendEmail = function (to, from, body, subject, bcc) {
    $.ajax({
        url: "../API/functions/email",
        type: "POST",
        data: {
            'to': to,
            'from': from,
            'body': body,
            'subject': subject,
            'bcc' : bcc
        },
        contentType: "application/json",
        success: function (data) {
           console.log(ko.toJSON(data));
        }
    });
}
</code></pre>

<p>How should I get the POST data in the Web API?
Is my javascript function correct?</p>

<p>Thanks in advance.</p>