发送邮件的异常处理 [英] Exception handling for sending mail
本文介绍了发送邮件的异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请给我一些代码来处理使用System.net.mail发送邮件时的异常...
Hi,
please give me some code to handle exceptions while sending mail using System.net.mail...
推荐答案
try
{
//发送邮件
}
赶上
{
MessageBox.Show(无法发送邮件");
}
您还可以选择捕获特定的异常类型,但是当异常发生时,您的操作确实取决于您.
try
{
//send mail
}
catch
{
MessageBox.Show("Could not send mail");
}
You can also choose to catch specific exception types, but what you do when they happen, is really up to you.
这篇关于发送邮件的异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文