@ Try {
System. Net. Mail. MailAddress from = new System. Net. Mail. MailAddress ("www.2cto.com", "ethan"); // enter the email address and display name.
System. Net. Mail. MailAddress to = new System. Net. Mail. MailAddress (www.2cto.com, "jimmy"); // enter the email recipient address and name.
// Set the Sending address and Receiving address. The Receiving address can be multiple
System. Net. Mail. MailMessage mail = new System. Net. Mail. MailMessage ();
Mail. From = from;
Mail. To. Add ();
Mail. Subject = "topic content ";
Mail. Body = "hello ";
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.163.com ";
// Enter the user name and password related to the server address
Client. Credentials = new System. Net. NetworkCredential ("www.2cto.com ","******");
// Send an email
Client. Send (mail );
}
Catch {
@: <B> failed to send </B>
}
Author: Cai_Ethan