public void SetEmail()
{
//电子邮件对象
MailMessage mailMessage = new MailMessage();
///发件人(网站管理员)
mailMessage.From = new MailAddress("邮件地址", "图书商城");
//收件人
mailMessage.To.Add(new MailAddress("1邮件地址", "图书商城会员"));
//邮件主题
mailMessage.Subject = "图书商城会员注册验证";
//邮件内容
mailMessage.Body = "33333";
//配置邮件服务器
SmtpClient client = new SmtpClient("smtp.qq.com");
//发件人的邮件用户名和密码
client.Credentials = new System.Net.NetworkCredential("发邮件的用户的名字", "密码");
//发送邮件
client.Send(mailMessage);
}
时间: 2024-10-13 12:28:13