MailMessage objMail = new MailMessage();
objMail.Subject = "邮件主题";
objMail.Body = "邮件正文";
string mfrom = txtFrom.Value; //从页面读取发送者地址
objMail.From = new MailAddress(mfrom);
string mt = txtTo.Value; //从页面读取接收者地址
MailAddress ma = new MailAddress(mt);
objMail.To.Add(ma);
objMail.IsBodyHtml = true;//指示邮件为html格式的值
objMail.Priority = MailPriority.High;//设置邮件的优先级
objMail.Attachments.Add(new Attachment("F:\\aba.doc"));//添加附件
SmtpClient smtp = new SmtpClient();
smtp.Host = "……"//smtp事务的IP地址,如smtp.cc.com
smtp.Send(objMail);//发送邮件
objMail.Subject = "邮件主题";
objMail.Body = "邮件正文";
string mfrom = txtFrom.Value; //从页面读取发送者地址
objMail.From = new MailAddress(mfrom);
string mt = txtTo.Value; //从页面读取接收者地址
MailAddress ma = new MailAddress(mt);
objMail.To.Add(ma);
objMail.IsBodyHtml = true;//指示邮件为html格式的值
objMail.Priority = MailPriority.High;//设置邮件的优先级
objMail.Attachments.Add(new Attachment("F:\\aba.doc"));//添加附件
SmtpClient smtp = new SmtpClient();
smtp.Host = "……"//smtp事务的IP地址,如smtp.cc.com
smtp.Send(objMail);//发送邮件
标签:
.net,发送邮件
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“.net发送邮件实现代码”评论...