nt client = new SmtpClient("smtp.163.com");
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("[email protected]", "cwy_speed");
client.DeliveryMethod = SmtpDeliveryMethod.Network;
MailAddress addressFrom = new MailAddress("[email protected]", "張三");
MailAddress addressTo = new MailAddress(strto, "李四");
System.Net.Mail.MailMessage message = new MailMessage(addressFrom, addressTo);
message.Sender = new MailAddress("[email protected]");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
client.Send(message);
(以上程式碼是可以正確執行的,並且是可以傳送出去的。)
nt client = new SmtpClient("smtp.163.com");
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("[email protected]", "cwy_speed");
client.DeliveryMethod = SmtpDeliveryMethod.Network;
MailAddress addressFrom = new MailAddress("[email protected]", "張三");
MailAddress addressTo = new MailAddress(strto, "李四");
System.Net.Mail.MailMessage message = new MailMessage(addressFrom, addressTo);
message.Sender = new MailAddress("[email protected]");
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
client.Send(message);
(以上程式碼是可以正確執行的,並且是可以傳送出去的。)