Wednesday, December 8, 2010

Open Outlook and attach file in Asp.net Application

//Param 1 denotes To address, Param Name2 denotes Attachment
function RunEXE(param1, param2){
var oShell = new ActiveXObject("WScript.Shell");
var prog = "C:\\ProgramData\\PRQS\\PRQSEmail.exe";
//var prog = "\\\\praveen-pc\\PRQS\\PRQSEmail.exe";
var quotes = "\"";
var cmdline = quotes + param1 + quotes + " " + quotes + param2 + quotes;
args = quotes + prog + quotes;
var intWindowStyle = 1; // 1= Activates and displays a window
var bWaitOnReturn = true; // Wait till Return
// alert(args);
oShell.run(args + " " + cmdline, intWindowStyle, bWaitOnReturn);
}

//Call This Javascript from code behind
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "RunEXE('" + eMailid + "','" + filepath + "');", true);

No comments:

Post a Comment