. NET to send mail,. net to send mail
Note: You need to find "POP3/SMTP Service" and enable it, And then generate an authorization code. The generated authorization code is the password for login below.
/// <Summary> /// send email /// </summary> /// <param name = "to"> recipients (separated) </param> /// <param name = "title"> title </param> /// <param name = "content"> content </param> /// <param name = "cc"> cc </param> // <returns> </returns> public string sendEmail (string, string title, string content, string cc = "") {try {System. net. mail. mailMessage myMail = new System. net. mail. mailMessage (); myMail. from = new System. net. mail. mailAddress ("xxx@qq.com", "xx notification", System. text. encoding. UTF8); // sender address, sender name, encoding string [] tos =. split (new string [] {";"}, StringSplitOptions. removeEmptyEntries); for (int I = 0; I <tos. length; I ++) {myMail. to. add (new System. net. mail. mailAddress (tos [I]);} string [] ccs = cc. split (new string [] {";"}, StringSplitOptions. removeEmptyEntries); for (int I = 0; I <ccs. length; I ++) {myMail. CC. add (new System. net. mail. mailAddress (ccs [I]);} myMail. subject = title; myMail. subjectEncoding = Encoding. UTF8; myMail. body = content; myMail. bodyEncoding = Encoding. UTF8; myMail. isBodyHtml = true; System. net. mail. smtpClient smtp = new System. net. mail. smtpClient (); smtp. host = "smtp.qq.com ";
Smtp. enableSsl = true; smtp. useDefaultCredentials = false; smtp. credentials = new System. net. networkCredential ("xxx@qq.com", "password"); smtp. deliveryMethod = System. net. mail. smtpDeliveryMethod. network; smtp. send (myMail); return "";} catch (Exception ee) {return ee. toString ();}}