invoke the client machine's outlook by creating an ActiveX object using javascript. This way I do not need my application to intertop and install outlook on the server (which would not have met the requirement anyway). Also unlike "mailto" there is no restrcitiion of the length of the email and format of the email could be designed in HTML.
This javascript would then be registered using Script Manager as I am also using AJAX controls on the site. Here's the code snippet for anyone who has a similar problem to deal with in the future:
string script = "var objO = new ActiveXObject('Outlook.Application');var objNS = objO.GetNameSpace('MAPI'); var mItm = objO.CreateItem(0); mItm.Display(); mItm.To = ''; mItm.Subject = '" + EmailReader.LoadEmailSubjectTemplate(Convert.ToInt32(refId)) + "';mItm.HTMLBody = '" + EmailReader.LoadEmailBodyTemplate(Convert.ToInt32(refId)) + "'; mItm.GetInspector.WindowState = 2;";
if (!ClientScript.IsStartupScriptRegistered(script))
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "Nomination", script, true);
}
No comments:
Post a Comment