I am using the code below to open Outlook as user clicks on "Email this
page"
try
{
string subjectEmail=string.Format("Magnet Alert Center - Alerts for :
{0}",Request.QueryString["accountid"]);
string messageEmail=string.Format("Dear recepient(s) ,you have been invited
to see alerts for {0}",Request.QueryString["accountid"]);
StartDefaultMail(subjectEmail,messageEmail);
}
catch (Exception ee)
{
throw new Exception("Error in initailizing components",ee);
}
}
private void StartDefaultMail(string subject,string message)
{
try
{
ProcessStartInfo psi=new ProcessStartInfo();
psi.UseShellExecute=true;
psi.FileName="mailto:" + HttpUtility.UrlEncode("") + "?subject=" +
HttpUtility.UrlEncode(subject) + "&body=" + HttpUtility.UrlEncode(message);
Process.Start(psi);
}
catch(Exception ee)
{
throw new Exception("Default mail client could not be started.",ee);
}
}
I get the following Error:
Cannot start process because a file name has not been provided.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Cannot start process
because a file name has not been provided.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Cannot start process because a file name has not
been provided.]
System.Diagnostics.Process.Start() +135
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +49
MagNetAlertCenter.WebForm1.StartDefaultMail(String subject, String
message) in \\tech\magnetalertcenter\index.aspx.cs:111
[Exception: Default mail client could not be started.]
MagNetAlertCenter.WebForm1.StartDefaultMail(String subject, String
message) in \\tech\magnetalertcenter\index.aspx.cs:115
MagNetAlertCenter.WebForm1.LinkButton1_Click(Objec t sender, EventArgs e)
in \\vandevsps01\magnetalertcenter\index.aspx.cs:94
[Exception: Error in initailizing components]
MagNetAlertCenter.WebForm1.LinkButton1_Click(Objec t sender, EventArgs e)
in \\tech\magnetalertcenter\index.aspx.cs:98
System.Web.UI.WebControls.LinkButton.OnClick(Event Args e) +108
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.Rai
sePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +138
System.Web.UI.Page.ProcessRequestMain() +