My mail program works on 2 boxes but throws "Failure sending mail" exception on the other box. This exception message is not very descriptive. Is there a way to dump the exception trace for the ease of debugging as discussed in here?
Thanks.
My mail program works on 2 boxes but throws "Failure sending mail" exception on the other box. This exception message is not very descriptive. Is there a way to dump the exception trace for the ease of debugging as discussed in here?
Thanks.
Sounds like you need to log the exception because it's running on a different box. You could look at Log4Net or Elmah
At it's simplest you can just write a text file to the file system
try
{
// Your mail code here
}
catch (Exception ex)
{
System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\log.txt");
file.WriteLine(ex.StackTrace);
file.Close();
}
You aren't guaranteed a particularly helpful stack trace, and you might want to log other bits of information from the exception as well. Last time I encountered this problem it was firewall rules that prevented contacting the host.