Here is some sample JavaScript code to send out an email:
if (typeof (SDK) == "undefined")
{ SDK = { __namespace: true }; }
//This will establish a more unique namespace for functions in this library. This will reduce the
// potential for functions to be overwritten due to a duplicate name when the library is loaded.
SDK.SAMPLES = {
_getServerUrl: function () {
///<summary>
/// Returns the URL for the SOAP endpoint using the context information available in the form
/// or HTML Web resource.
///</summary>
var ServicePath = "/XRMServices/2011/Organization.svc/web";
var serverUrl = "";
if (typeof GetGlobalContext == "function") {
var context = GetGlobalContext();
serverUrl = context.getServerUrl();
}
else {
if (typeof Xrm.Page.context == "object") {
serverUrl = Xrm.Page.context.getServerUrl();
}
else
{ throw new Error("Unable to access the server URL"); }
}
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
}
return serverUrl + ServicePath;
},
SendEmailRequest: function () {
var requestMain = ""
requestMain += "<s:Envelope xmlns:s=\"schemas.xmlsoap.org/.../envelope\">";
requestMain += " <s:Body>";
requestMain += " <Execute xmlns=\"schemas.microsoft.com/.../Services\" xmlns:i=\"www.w3.org/.../XMLSchema-instance\">";
requestMain += " <request i:type=\"b:SendEmailRequest\" xmlns:a=\"schemas.microsoft.com/.../Contracts\" xmlns:b=\"schemas.microsoft.com/.../Contracts\">";
requestMain += " <a:Parameters xmlns:c=\"schemas.datacontract.org/.../System.Collections.Generic\">";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>EmailId</c:key>";
requestMain += " <c:value i:type=\"d:guid\" xmlns:d=\"schemas.microsoft.com/.../Serialization\">dc946d36-3e41-e111-9d05-0050569838b7</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>IssueSend</c:key>";
requestMain += " <c:value i:type=\"d:boolean\" xmlns:d=\"www.w3.org/.../XMLSchema\">true</c:value>";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " <a:KeyValuePairOfstringanyType>";
requestMain += " <c:key>TrackingToken</c:key>";
requestMain += " <c:value i:type=\"d:string\" xmlns:d=\"www.w3.org/.../XMLSchema\" />";
requestMain += " </a:KeyValuePairOfstringanyType>";
requestMain += " </a:Parameters>";
requestMain += " <a:RequestId i:nil=\"true\" />";
requestMain += " <a:RequestName>SendEmail</a:RequestName>";
requestMain += " </request>";
requestMain += " </Execute>";
requestMain += " </s:Body>";
requestMain += "</s:Envelope>";
var req = new XMLHttpRequest();
req.open("POST", SDK.SAMPLES._getServerUrl(), false)
req.setRequestHeader("Accept", "application/xml, text/xml, */*");
req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
req.setRequestHeader("SOAPAction", "schemas.microsoft.com/.../Execute");
req.send(requestMain);
//work with the response here
//var strResponse = req.responseXML.xml;
//alert(strResponse.toString());
},
__namespace: true
};
Source: mileyja.blogspot.co.uk/.../send-email-synchronously-in-microsoft.html
Also look at this:
mileyja.blogspot.co.uk/.../create-email-activity-in-microsoft.html
ankit.inkeysolutions.com/.../dynamics-crm-2011-creating-e-mail.html
Hope this helps! Please click on "yes" to verify the answer if you found this response helpful.