private void EmailErrorClickHandler(object sender, EventArgs e)
{
try
{
string userDescription = "";
ErrorDescriptionForm errorDescriptionForm = new ErrorDescriptionForm();
errorDescriptionForm.Closing +=
delegate { userDescription = errorDescriptionForm.ErrorDescriptionTextBox.Text; };
errorDescriptionForm.ShowDialog(this);
IDictionary dictionary = GetEmailErrorSettings();
string exceptionString = ExceptionUtilities.GetExceptionString(_exception, 0, true);
if (!string.IsNullOrEmpty(userDescription))
{
exceptionString = "User Description : " + Environment.NewLine + userDescription +
Environment.NewLine + " - Exception : " + exceptionString;
}
if (dictionary != null)
{
try
{
SendErrorMessage(dictionary, exceptionString);
return;
}
catch (Exception ex)
{
exceptionString += Environment.NewLine + " - Error sending mail via smtp: " +
Environment.NewLine + ex.Message;
}
}
System.Diagnostics.Process.Start("mailto:?subject=" + _exception.Source + "&body=" + exceptionString);
}
catch (Exception ex)
{
MessageBox.Show("The error message was not sent due to the following error : " + Environment.NewLine +
ex.Message);
}
}