private void btnSend_Click(object sender, EventArgs e) { MailMessage mailMsg = new MailMessage(); mailMsg.From = new MailAddress("lenovo_1999@163.com", "Peter"); mailMsg.To.Add("lenovo_1999@163.com");
mailMsg.Subject = "IDST_TEST";//发送邮件的标题
StringBuilder builder = new StringBuilder();
builder.Append("用户名:" + "wgw");
builder.Append("<table border='0px'><tr><td>Linecode</td><td>PPNO</td></tr></table>");
mailMsg.Body = builder.ToString();
mailMsg.IsBodyHtml = true;
SmtpClient client = new SmtpClient("smtp.163.com");//smtp.163.com,smtp.qq.com
client.Credentials = new NetworkCredential("lenovo_1999", "");//指定的是发件人邮箱的用户名和密码 //lenovo_1999@163.com
client.Send(mailMsg);//将邮件发送到SMTP服务器上。 }