.net发邮件

System.Net.Mail.SmtpClient smtpClient = new SmtpClient("smtp.126.com");

smtpClient.UseDefaultCredentials = false;

smtpClient.Credentials = new System.Net.NetworkCredential("yongkai", "password");

smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

MailMessage message = new MailMessage("[email protected]", "[email protected]"); message.Subject = "Test Subject";

message.Body = "Test Body";

smtpClient.Send(message);

你可能感兴趣的:(.net)