Sending Email error reports from windows desktop application
I have a windows desktop application running on clients machines using .NET 4.0. When an error occur, The application catches it and needs to send it to the support team b email.
The question is how to send an email with开发者_运维问答 the full stack trace (including stacktrace for inner exception if there is one) using email?
I tried using the "Mailto:" but It wouldnt work when the body exceeds a certain length.
What options do I have?
System.Net.Mail namespace contains classes that handle sending mail with the smtp protocol. It may have a size limit, but I haven't found it yet in normal usage.
If you do manage to find a size limit, try writing the error log to a file an attaching it.
Also, as an easier way to do this, you might also consider Log4Net to simplify logging in all manner of ways, including email with the SmtpAppender.
精彩评论