通过密送发送邮件

时间:2011-02-01 10:27:45

标签: c# asp.net email

如何在asp.net(c#)中通过bcc发送群发邮件.. ??

2 个答案:

答案 0 :(得分:3)

根据the documentation你这样做:

public static void CreateBccTestMessage(string server)
{
MailAddress from = new MailAddress("ben@contoso.com", "Ben Miller");
MailAddress to = new MailAddress("jane@contoso.com", "Jane Clayton");
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the SmtpClient class.";
message.Body = @"Using this feature, you can send an e-mail message from an application very easily.";
MailAddress bcc = new MailAddress("manager1@contoso.com");
message.Bcc.Add(bcc);
SmtpClient client = new SmtpClient(server);
client.Credentials = CredentialCache.DefaultNetworkCredentials;
Console.WriteLine("Sending an e-mail message to {0} and {1}.", 
           to.DisplayName, message.Bcc.ToString());
  try {
    client.Send(message);
  }  
  catch (Exception ex) {
    Console.WriteLine("Exception caught in CreateBccTestMessage(): {0}", 
                ex.ToString() );
  }
}

您只需添加几个密件抄送地址。请注意,发送群发邮件很容易将您列入黑名单,并且您的大多数邮件可能最终都会被列入垃圾邮件文件夹。您应该考虑使用群发邮件服务提供商。

答案 1 :(得分:0)

您可以使用System.Net.Mail命名空间类来发送.net应用程序中的邮件。请参阅MSDN文档:http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx