C# 邮件发送方法【webMail方式】(二)

2014-11-24 14:34:33 · 作者: · 浏览: 8
yEncoding = System.Text.Encoding.UTF8;
System.Web.Mail.SmtpMail.SmtpServer = strSMTPServer;

System.Web.Mail.SmtpMail.Send(message);
}
}

bState = true;
}
catch (Exception ex)
{
System.IO.File.AppendAllText("C:\\Mail_Log.ini", string.Format("{0:yyyy/MM/dd HH:mm:ss}\r\n{1}\r\n\r\n", DateTime.Now, ex.Message));
bState = false;
strErrorMsg = ex.Message;
}

return bState;
}


//测试发送邮件


}


邮件在webconfig文件中配置如下: