In order to proceed to the following code, please be informed that the UserKey will be exposed at your client side. This can be used by irresponsible party to send emails using your account which may affect your sending domain reputation. Please use with caution.
function sendRequest() {
var method = 'POST';
var serviceUrl = 'https://api.enginemailer.com/RESTAPI/Submission/SendEmail';
var email = {
UserKey: "your_userID_given_by_Enginemailer",
ToEmail: $('#ToEmail').val(),
Subject: $('#Subject').val(),
SenderEmail: $('#SenderEmail').val(),
SenderName: $('#SenderName').val(),
SubmittedContents: $('#SubmittedContent').val(),
Attachments: $('#Attachments').val()
}
$.ajax({
type: method,
url: serviceUrl,
data: JSON.stringify(email),
contentType: "application/json; charset=utf-8",
traditional: true
}).done(function (data) { $('#value1').text(data); }).error(function (jqXHR, textStatus, errorThrown) { $('#value1').text(jqXHR.responseText || textStatus);
});
}