Change the password for email verification, retrieve the password through email, and change the password to retrieve the password

Source: Internet
Author: User
Tags mailmessage smtpclient

Change the password for email verification, retrieve the password through email, and change the password to retrieve the password

Use email verification to change the password. Here I use 163 free mail for testing

Front-end code

1 <input type = "text" name = "Mail" id = "Mail"/> 2 <span> * enter your email address </span> <br/> 3 <asp: button ID = "zhuce" runat = "server" Text = "tijiao" OnClick = "btn"/>

Background code

1 protected void btn (object sender, EventArgs e) 2 {3 string mail = Context. request ["Mail"]; 4 MailMessage message = new MailMessage (); 5 message. from = new MailAddress ("######", "#####"); // The sender address 6 message. to. add (mail); // The target sender address 7 message. subject = "dssdds"; // mail Title 8 message. body = "nihao"; // mail content 9 // smtp server address for sending mail 10 SmtpClient smtp = new SmtpClient ("smtp.163.com"); 11 smtp. credentials = new NetworkCredential ("#########", "#####"); // the sender's username and password 12 smtp. send (message); 13}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.