MailMessage email = new MailMessage("MailFrom", "MailTo");
email.Subject = "";// 设置邮件主题
email.Body = "";
//Message.BodyFormat = MailFormat.Text; //文本类型
SmtpClient client = new SmtpClient();
client.Host = "smtp.163.com";//转发主机
client.Port = 25;//端口号
client.EnableSsl = false;//是否进行SSL加密
client.UseDefaultCredentials = false;//此属性的设置要出现在client.Credentials的前面,不然会报错
client.Credentials = new NetworkCredential("用户名", "密码");//发送人邮箱的用户名和密码
client.Send(email);
Console.WriteLine("成功");