从.NET应用程序发送电子邮件的最好方法?应用程序、发送电子邮件、方法、NET

2023-09-02 11:54:32 作者:Non fish 子非鱼

我工作的一个Windows窗体(.NET 3.5)应用程序,它有一个内置的异常处理程序来捕捉任何(但愿),可能arrise例外。我想在异常处理程序能够提示用户点击发送错误报告按钮,然后将导致该应用发送电子邮件到我的FogBugz的电子邮件地址。

I'm working on a Windows Forms (.NET 3.5) application that has a built-in exception handler to catch any (heaven forbid) exceptions that may arrise. I'd like the exception handler to be able to prompt the user to click a "Send Error Report" button, which would then cause the app to send an email to my FogBugz email address.

什么是做到这一点的最好办法,以及是否有任何陷阱要提防?

What's the best way to do this, and are there any "gotchas" to watch out for?

推荐答案

您会希望使用SmtpClient类概括的的这里 。 有没有陷阱 - 发送电子邮件是因为它得到一样简单

You'll want to use the SmtpClient class as outlined here. There are no gotchas - sending email is about as easy as it gets.