开发者

send mail through bcc

how can i send mass mail开发者_JAVA百科 through bcc in asp.net(c#)..??


According to the documentation you do it like this:

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() );
  }
}

You just add several bcc addresses. Note that sending mass mails will easily get you blacklisted and most of your messages will probably end up in spam folders. You should consider using a mass mail service provider for this instead.


You can make you of the System.Net.Mail namespace classes for send out mails in .net applications. Refer to MSDN documentation: http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜