C # send a simple email,
System. Net. Mail. MailMessage message = new System. Net. Mail. MailMessage ();
Message. From = new System. Net. Mail. MailAddress ("***** @ 163.com"); // send email
Message. To. Add ("********* @ qq.com"); // recipient
Message. Subject = "**********"; // mail title
Message. IsBodyHtml = true;
Message. BodyEncoding = System. Text. Encoding. UTF8;
Message. Body = "***************"; // mail content
Message. Priority = System. Net. Mail. MailPriority. Normal;
System. Net. Mail. SmtpClient client = new System. Net. Mail. SmtpClient ("smtp.163.com", 25); // 163 email address, 25 port number
Client. credentials = new System. net. networkCredential ("*********** @ 163.com"," ********* "); // The Mail Box Name of the first parameter, the second parameter mailbox Password
Client. EnableSsl = false; // ssl encryption is required.
Try
{
Client. Send (message); // Send
}
Catch (Exception ee)
{
LogHelper. GetInstance (). WriteMessage (DateTime. Now + "failed to send the order Email:" + ee. Message); // failed to send, Operation
}
This message only tests personal accounts and does not test enterprise-level mailboxes. If you have any questions at the enterprise level, you can communicate with each other.