MVC5 send email registration, mvc5 send email
# Region send email // enter the email address and display name System. net. mail. mailAddress from = new System. net. mail. mailAddress ("xxx@126.com", "wode"); // enter the recipient address and name of the email System. net. mail. mailAddress to = new System. net. mail. mailAddress ("xxx@qq.com", "nide"); // set the Sending address, and receiving address, the receiving address can be multiple systems. net. mail. mailMessage mail = new System. net. mail. mailMessage (); mail. from = from; mail. to. add (to); mail. subject = "topic content"; System. text. stringBuilder strBody = new System. text. stringBuilder (); strBody. append ("Click <a href = \" "+ callbackUrl +" \ "> here </a> to confirm your account"); mail. body = strBody. toString (); mail. isBodyHtml = true; // set to display htmls // set the mail service address System. net. mail. smtpClient client = new System. net. mail. smtpClient (); client. host = "smtp.126.com"; // here, 126 is used for sending emails. Therefore, "smtp.126.com" // enter the user name and password related to the server address client. credentials = new System. net. networkCredential ("xxx@126.com", "This needs to enable smtp in 126 mailbox, then enter the password set"); // send the mail client. send (mail); # endregion