public void SendMail(string to, string subject, string body, bool isBodyHtml)
{
MailMessage mail = new MailMessage();
mail.To.Add(to);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = isBodyHtml;
mail.From = new MailAddress("邮箱");
SmtpClient client = new SmtpClient();
client.Send(mail);
}
<system.net>
<mailSettings>
<smtp from="邮箱">
<network host="smtp.sohu.com"
userName="邮箱"
password="密码"
defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>