public void sendMail(string SendToEmail,string UserName,string content)
{
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.From = new System.Net.Mail.MailAddress("penjiluwa@126.com");
mail.To.Add(new System.Net.Mail.MailAddress(SendToEmail));
mail.Subject = "学业通激活码";
mail.Body = "尊敬的客户"+UserName+"<br/>,"+content;
mail.Priority = MailPriority.High;
mail.BodyEncoding = System.Text.UnicodeEncoding.UTF8; //编码
mail.SubjectEncoding = System.Text.UnicodeEncoding.UTF8; //编码
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.126.com");//你的email的smtp地址
client.UseDefaultCredentials = true;
client.Credentials = new System.Net.NetworkCredential("ss@126.com", "123456");
//换成你自己的邮箱用户名和密码client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mail);
}
以前用过一个类似的,你设置好你自己邮箱的信息,循环调用一遍就可以了。这个方法用过没有问题的:)
mark~~