Server
From MobileX for SageCRM
The server plugin is stored in "js\\plugins\\PLUGINNAME\\server\\FILENAME.js
if (params.EntityId) {
var sql = "select pers_emailaddress \ from vsummaryperson \ where pers_personid={0}";
sql = clr.System.String.Format(sql, params.EntityId);
var jsonResult = SQLJSONSerializer.ExecuteQueryToJSON(sql, false);
var jsonObject = eval(jsonResult);
//Response.Write('alert(\'EntityId='+jsonObject[0].pers_emailaddress+'\');');
var emailBody = email.GetFileContents("C:\\Program Files (x86)\\Sage\\CRM\\CRMDemo\\WWWRoot\\CustomPages\\SageCRMWS\\js\\plugins\\CRMTogether\\server\\email.txt");
var emailSettings = { to: jsonObject[0].pers_emailaddress, From: "uname@server.com", subject: "test subject", body: emailBody, host: "smtp.server.com", port: "123", UserName: "uname@server.com", Password: "password", pIsBodyHtml: true, pEnableSsl: true }
//Response.Write('alert(\'emailBody='+emailSettings.subject+'\');');
email.SendEmail(emailSettings.to, emailSettings.From, emailSettings.subject, emailSettings.body, emailSettings.host, emailSettings.port, emailSettings.UserName, emailSettings.Password, emailSettings.pIsBodyHtml, emailSettings.pEnableSsl);
//this is displayed on screen Response.Write('Email sent');
}