惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
K
Kaspersky official blog
L
LINUX DO - 热门话题
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
Cisco Talos Blog
Cisco Talos Blog
AI
AI
L
LINUX DO - 最新话题
H
Heimdal Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
Webroot Blog
Webroot Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The GitHub Blog
The GitHub Blog
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
S
Securelist
博客园_首页
IT之家
IT之家
Schneier on Security
Schneier on Security
博客园 - 叶小钗
罗磊的独立博客
WordPress大学
WordPress大学
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
阮一峰的网络日志
阮一峰的网络日志
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
The Register - Security
The Register - Security
D
DataBreaches.Net
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tailwind CSS Blog
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
T
Tor Project blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - 豆丁不想长大

CheckBoxList与表的操作 - 豆丁不想长大 - 博客园 判断用户浏览器类型的代码 - 豆丁不想长大 - 博客园 GridView的RowdataBound事件 后台代码创建Table javascript循环判断Radio是否选中 - 豆丁不想长大 - 博客园 不错的韩剧 19根烟忘却你的理由 28句朴素的道白 Web.config详解 - 豆丁不想长大 - 博客园 弹出对话框后转到下一页的代码 后台编写返回上一页的代码 Gridview中的DataKeys問題 FindControl的作用 ASP.net2.0学习资料汇总 星巴克咖啡价格 ASP.NET 常用代码 MessageBox的CS文件中的写法 Split的用法 关于DDL控件提交后刷新问题
忘记密码发送邮件提醒的代码
豆丁不想长大 · 2007-02-15 · via 博客园 - 豆丁不想长大

 1 public partial class CustomersForgetPassWord : System.Web.UI.Page
 2 {
 3     //public TextBox UserBox;
 4     private string emailstring;
 5     private string forgetuser;
 6     private string forgetpass;
 7     public SqlConnection sqlconn;
 8     public SqlCommand sqlcomm;
 9     public SqlDataReader slqdtrdr;
10     static bool mailSent = false;
11 
12     protected void Page_Load(object sender, EventArgs e)
13     {
14 
15     }
16     protected void GetButton_Click(object sender, EventArgs e)
17     {
18         try
19         {
20             string strconn = ConfigurationSettings.AppSettings["scon"];
21             sqlconn = new SqlConnection(strconn);
22             sqlconn.Open();
23             string strsql = "select * from Customers where CustomerUserName='" + UserBox.Text + "'";
24             sqlcomm = new SqlCommand(strsql, sqlconn);
25             slqdtrdr = sqlcomm.ExecuteReader(CommandBehavior.CloseConnection);
26             if (slqdtrdr.Read())
27             {
28                 Session["CustomerID"]=slqdtrdr["CustomerID"].ToString();
29                 //emailstring = "zhaojing@etong2000.com";
30                 emailstring = String.Format("{0}", slqdtrdr[5]);
31                 forgetuser = String.Format("{0}", slqdtrdr[1]);
32                 //forgetpass = String.Format("{0}",slqdtrdr[5]);
33             }
34             else
35             {
36 
37             }
38         }
39         catch (Exception en)
40         {
41 
42         }
43         finally
44         {
45             slqdtrdr.Close();
46             slqdtrdr.Dispose();
47             sqlconn.Close();
48         }
49         //specify SMTP Server
50         string server = "mail.etong2000.com";
51         if (UserBox.Text != forgetuser)
52         {
53             Response.Write("<script>alert('Can not send to your email box!')</script>");
54         }
55         else
56         {
57             try
58             {
59                 forgetpass = DateTime.Now.Millisecond.ToString() + DateTime.Now.Second.ToString();
60                 //smtp server
61                 string strSmtpServer = "amidco.com";
62                 //username for sending
63                 //string strTo = "info@amidco.com,williamlroberts@gmail.com,gregdirst2@yahoo.com";
64                 //string strTo = "zhaojing@etong2000.com";
65                 //password for sending
66                 string strFromPass = "781106";
67                 //target of sending
68                 string strFrom = "qi.tong@amidco.com";
69                 //subject of sending
70                 string strSubject = "Foodservice Industry Network, LLC";
71                 //body of sending
72                 string strBody = "Foodservice Industry Network, LLC" + "\n" + "Forget Password." + "\n" + "User Name: " + forgetuser + " Your Temporary Password is: " + forgetpass + " Please Change it!";
73 
74                 System.Net.Mail.SmtpClient client = new SmtpClient(strSmtpServer);
75                 client.UseDefaultCredentials = false;
76                 client.Credentials = new System.Net.NetworkCredential(strFrom, strFromPass);
77                 client.DeliveryMethod = SmtpDeliveryMethod.Network;
78 
79                 System.Net.Mail.MailMessage message = new MailMessage("info@foodserviceindustrynetwork.com", emailstring, strSubject, strBody);
80                 message.BodyEncoding = System.Text.Encoding.UTF8;
81                 message.IsBodyHtml = true;
82                 Response.Write("<script language='javascript'>window.alert('Your Temporary password has been sent to your email box.');window.location='./UserCode/CustomersChangePassword.aspx';</script>");
83                 client.Send(message);
84             }
85             catch (Exception ex)
86             {
87                 Response.Write("<script>alert('Can not send to your email box!')</script>");
88                 //Response.Write(ex.Message);
89             }
90         }
91     }