private void Toemail () {try {//Mail send class? MailMessage mail = new MailMessage (); Who sent the message? Mail. from = new MailAddress ("[email protected]", "ZX"); Sent to who? Mail. To.add ("[email protected]"); Title? Mail. Subject = "Test"; Content encoding? Mail. bodyencoding = Encoding.default; Send priority? Mail. priority = Mailpriority.high; Message content? Mail. Body = "Setet"; Is it sent in HTML form? Mail. Isbodyhtml = true; mail server and port? SmtpClient smtp = new SmtpClient ("smtp.qq.com", 25); Smtp. useDefaultCredentials = false; Specifies whether to smtpclient a connection using Secure Sockets Layer (SSL) encryption. Smtp. Enablessl = true; Specify how to send? Smtp. Deliverymethod = Smtpdeliverymethod.network; Specify LoginRecord name and password? Smtp. Credentials = new System.Net.NetworkCredential ("2475523429", "IMJRWMHJHEEKDHHD"); Time out? Smtp. Timeout = 10000; Smtp. Send (mail); } catch (Exception exp) {MessageBox.Show ("Send mail Exception"); } }
C # Send mail method