标签:
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(); client.Host = "smtp.qq.com";//SMTP服务器 client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; client.Port = 25; client.UseDefaultCredentials = true; client.Credentials = new System.Net.NetworkCredential("1000", "******");//SMTP服务器需要用户名和密码作认证(这里填写qq号和独立密码) //这里假定你已经拥有了一个qq邮箱的账户,qq号为1000,密码为*******(qq邮箱需要开启SMTP服务,开启时会需要设置独立密码这里的密码采用的是独立密码) System.Net.Mail.MailMessage Message = new System.Net.Mail.MailMessage(); //创建一个电子邮件类 Message.From = new System.Net.Mail.MailAddress("1000@qq.com"); //发件人Email Message.To.Add("123@qq.com"); //收件人Email Message.Subject = "邮件标题"; Message.Body = "邮件内容"; Message.SubjectEncoding = System.Text.Encoding.UTF8; Message.BodyEncoding = System.Text.Encoding.UTF8; Message.Priority = System.Net.Mail.MailPriority.High; Message.IsBodyHtml = false; client.Send(Message);
标签:
原文地址:http://www.cnblogs.com/bweb/p/4774802.html