Please check the following code.
var createEmail = new XrmServiceToolkit.Soap.BusinessEntity("email");
createEmail.attributes["subject"] = "Test Email subject";
createEmail.attributes["description"] = "This email was created by the XrmServiceToolkit.Soap.Create() sample.";
var from = [
{ id: whoamiUserId, logicalName: "systemuser", type: "EntityReference" }
];
createEmail.attributes["from"] = { value: from, type: "EntityCollection" };
var to = [
{ id: accountId, logicalName: "account", type: "EntityReference" },
{ id: contactId, logicalName: "contact", type: "EntityReference" }
];
createEmail.attributes["to"] = { value: to, type: "EntityCollection" };
var cc = [
{ id: accountId, logicalName: "account", type: "EntityReference" },
{ id: contactId, logicalName: "contact", type: "EntityReference" }
];
createEmail.attributes["cc"] = { value: cc, type: "EntityCollection" };
var bcc = [
{ id: accountId, logicalName: "account", type: "EntityReference" },
{ id: contactId, logicalName: "contact", type: "EntityReference" }
];
createEmail.attributes["bcc"] = { value: bcc, type: "EntityCollection" };
createEmail.attributes["directioncode"] = true;
emailId = XrmServiceToolkit.Soap.Create(createEmail);
Please download XrmServiceToolkit from the following link
xrmservicetoolkit.codeplex.com
thanks
Anil