/// <summary>
??? /// 注冊時發送用戶帳號跟密碼
??? /// </summary>
??? /// <param name="receiver">用戶注冊郵箱</param>
??? /// <param name="username">用戶名</param>
??? /// <param name="password">用戶密碼明文</param>
??? public bool Register(string receiver, string username, string password)
??? {
??????? System.Net.Mail.SmtpClient client;
??????? client = new System.Net.Mail.SmtpClient("smtp.126.com");
??????? client.Timeout = 60000;
??????? client.UseDefaultCredentials = false;
??????? client.Credentials = new System.Net.NetworkCredential("
郵箱號
", "郵箱密碼");
??????? client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
??????? System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
??????? message.SubjectEncoding = System.Text.Encoding.UTF8;
??????? message.BodyEncoding = System.Text.Encoding.UTF8;
??????? message.From = new System.Net.Mail.MailAddress("
郵箱號
", "顯示名稱", System.Text.Encoding.UTF8);
??????? message.To.Add(new System.Net.Mail.MailAddress(receiver, username, System.Text.Encoding.UTF8));
??????? message.IsBodyHtml = false;//是否html編碼
??????? message.Subject = "用戶注冊信息";
??????? message.Body = username + ":您好!/r/n??? 您注冊的用戶名是:" + username + ";密碼是:" + password + "。/r/n??? ";
??????? try
??????? {
??????????? client.Send(message);
??????????? Response.Write("發送成功!");
??????????? return true;
??????? }
??????? catch
??????? {
??????????? return false;
??????? }
??? }
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
