在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
/// <summary> /// 发送电子邮件 /// </summary> /// <param name="from">发件人</param> /// <param name="to">收件人</param> /// <param name="subject">邮件主题</param> /// <param name="body">邮件内容</param> /// <param name="host">发送服务地址(smtp.qq.com)</param> /// <param name="port">发送邮件服务器端口(25) int型</param> /// <param name="userName">用户名</param> /// <param name="password">密码</param> public void Send(string from, string to, string subject, string body, string host, int port, string userName, string password) { MailMessage message = new MailMessage(from, to, subject, body); message.IsBodyHtml = true; SmtpClient client = new SmtpClient(host, port); client.Credentials = new System.Net.NetworkCredential(userName, password); client.Send(message); }
|
请发表评论