代码: //创建MailMessage对象
MailMessage mailMsg = new MailMessage();
//设置收件人的邮件地址
mailMsg.To = mailFrom;
//设置发送者的邮件地址
mailMsg.From = Config.Settings.SendUserName;
//设置邮件主题
mailMsg.Subject = "你好:" + Userpetname + ",欢迎注册!";
//设置优先级别。
//mailMsg.Priority = MailPriority.Low;
//设置邮件内容
string Body  = Config.Settings.Body;
string activationUrl = "http://com./UserActivation.aspx";
Body.Replace( "http", activationUrl );
mailMsg.Body = Body;
//设置支持服务器验证
mailMsg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1" );
//设置用户名
mailMsg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername", Config.Settings.ServerUserName );  
//设置用户密码
mailMsg.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword", Config.Settings.ServerUserPassword ); try
{
//设置发送邮件服务器
SmtpMail.SmtpServer = Config.Settings.SmtpServer;
//发送邮件
SmtpMail.Send(mailMsg);
sendFlag = true; //this.Message.Text = "发送成功"; }
catch (System.Web.HttpException ehttp)
{
//Message.Text = "发送失败" + ehttp.ErrorCode + ehttp.HelpLink + ehttp.Message ;
com.piao.commonLib.log.Logger.Error( ehttp.ToString() );
}
catch (Exception ex)
{
com.piao.commonLib.log.Logger.Error( ex.ToString() );
}

报错原因: 
调用的目标发生了异常。 ---> System.Runtime.InteropServices.COMException (0x80040211): 邮件无法发送到 SMTP 服务器。传输错误代码为 0x800ccc15。服务器响应为 not available