Public Mailmessage initial ( String Address) {mailmessage m_mail = New Mailmessage (); // Sender M_mail.from = New Mailaddress ( " * ***** @ 126.com " ); // Recipient M_mail.to.add ( New Mailaddress (Address )); // Topic M_mail.subject = " The proxy has not been verified for a long time !!! " ; // Content M_mail.body = " Please reopen it !!! " ; // Subject and body encoding formats M_mail.subjectencoding = System. Text. encoding. utf8; m_mail.bodyencoding = System. Text. encoding. utf8; // The email body is HTML encoded. M_mail.isbodyhtml = True ; // Priority M_mail.priority = System. net. Mail. mailpriority. High; // Add attachments. You can add multiple attachments. // M_mail.attachments.add (new attachment ("C: \ 1.txt ")); // Bcc cc recipient M_mail.bcc.add (Address ); // CC recipient M_mail.cc.add (Address ); Return M_mail;} A smtpclient Client = New Smtpclient (); // You can use split to intercept the user name in this location from the sender. Client. Credentials = New System. net. networkcredential ( " **** " , Password); client. Port = 25 ; Client. Host = " Smtp.126.com " ; Try {Client. Send (initial ( " * ***** @ QQ.com " )); // Clientscript. registerstartupscript (this. GetType (), "myscript", "<SCRIPT> alert ('sent successfully! ') </SCRIPT> "); Succmsg. Add ( " Email sent! " + " * ***** @ QQ.com " ); Return True ;} Catch (System. net. Mail. smtpexception ex) {succmsg. Add ( " Failed to send email! " + " * ***** @ QQ.com " ); Return False ;}