C#中的电子邮件处理

1 .net c# email

我需要知道在C#/ .NET Framework中处理电子邮件的对象名称.

eKe*_*ek0 6

您需要命名空间System.Net.Mail.

以下是ScottGu博客的一个例子.

MailMessage message = new MailMessage();
message.From = new MailAddress("sender@foo.bar.com"); 

message.To.Add(new MailAddress("recipient1@foo.bar.com"));
message.To.Add(new MailAddress("recipient2@foo.bar.com"));
message.To.Add(new MailAddress("recipient3@foo.bar.com")); 

message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
message.Subject = "This is my subject";
message.Body = "This is the content";


SmtpClient client = new SmtpClient();
client.Send(message);
Run Code Online (Sandbox Code Playgroud)