E-mail verification code

 void the MailSend public (String In Email)
        {
            the MailMessage the MyMail the MailMessage new new = ();
            MyMail.From the MailAddress new new = ( "server email address", "Display name, also be empty");
            MyMail.To.Add (the MailAddress new new ( email)); // emial client e-mail address
            MyMail.Subject = "check"; // message header
            the StringBuilder = new new ContentBuilder the StringBuilder ();
            contentBuilder.Append ( "please click on the following link to complete activation");
            contentBuilder.Append ( "<a href='http://localhost:4064/Account2/repassword?email=" + email + "'> activated </a>");
            MyMail.Body contentBuilder.ToString = ();
            MyMail.IsBodyHtml to true = ;
            SmtpClient smtpclient = new SmtpClient();
            // sender email address and password, pay attention here to the sender's email address is consistent
            smtpclient.Credentials = new System.Net.NetworkCredential ( "server e-mail address", "password email address");
            smtpclient.DeliveryMethod = SmtpDeliveryMethod .Network;
            smtpclient.Host = "smtp.ym.163.com"; // E-mail site, a different mailbox this position different
            smtpclient.EnableSsl = true;
            smtpclient.Send(MyMail);
        }

Guess you like

Origin www.cnblogs.com/yiweizheng/p/12164768.html