求教:电商定期发送(网站)网页信息的代码实现?
求教:电商定期发送(网站)网页信息的代码实现?经常接到京东商城的定期发送来的其网站的网页信息,可以直接点击连接到其网站。
求教老师:
1.如何代码实现?
2.如何发送的,或通过什么邮箱发送的?
多谢老师的指导!!!
using using //命名空间及类定义省去... private const string _mailContent = "<!DOCTYPE html><html xmlns=\"http://www.\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/><title></title><style type=\"text/css\">.auto-style1 {color: #6600FF;}</style></head><body style=\"font-size: small; background-color: #F6F6F6; padding: 10px 10px 10px 10px\"><table style=\"margin: 10px; width:100%;\"><tr><td><img alt=\"\" src=\"http://www.\" /></td></tr><tr><td style=\"height: 15px\"></td></tr><tr><td style=\"height: 20px\">尊敬的用户xxUser:</td></tr><tr><td style=\"height: 20px\">感谢您对YourSite的支持,您申请找回的帐户密码如下,请您<span class=\"auto-style1\"><strong>记下并妥善保管以防不便。</strong></span></td></tr><tr><td><hr /></td></tr><tr><td style=\"height: 30px;font-size: 20px; text-align: center; color: #3366FF;\">xx密码</td></tr><tr><td><hr /></td></tr><tr><td style=\"height: 20px;\">更多精彩内容敬请访问 <a href=\"http://www.\">www. style=\"height: 20px;\">服务邮箱:<a href=\"mailto:service@\">service@问题及建议反馈邮箱:<a href=\"mailto:service@\">bug@\"height: 20px\">这是一封系统邮件,请勿回复。</td></tr></table></body></html>"; public bool SendPasswordMail(string fromAddress, string toAddress, string mailPassword, string userName, string password) { var ms = new MailMessage { Body = _mailContent.Replace("xxUser", userName).Replace("xx密码", password), From = new MailAddress(fromAddress), Subject = "密码找回邮件,请查看您在被遗忘的密码", BodyEncoding = Encoding.UTF8, IsBodyHtml = true }; ms.To.Add(toAddress); var smtpClient = new SmtpClient { Credentials = new NetworkCredential(fromAddress, mailPassword), Port = 25, Timeout = 720, Host = "" }; smtpClient.Send(ms); return true; }