bcc collection in system.Net.Mail

Discussion in 'ASP.NET 2.0' started by eflamm, Feb 16, 2007.

  1. Thanks, Vikram. That's basically the code I already have. In fact, when I had a user hit the site, I got the bcc just as expected, so I'm thinking that the mail server may have dropped the bcc which had the same address as the cc (when I was the user).


    Eric
     
  2. As I understand it, the MailMessage class in System.Net.Mail includes 3 address collections: To, CC, and BCC. I have a page which sends an e-mail, and it uses the add method to add a mailaddress to the cc collection and the bcc collection. It looks to me like the cc is being sent, but the bcc isn't. Is there a configuration I need to change to make this work, or is it something about the SMTP service on DASP's servers?

    Thanks!
     
  3. There is no special configuration for bcc to work.It should work fine just as the cc and to addresses.Also make sure that your bcc address is not considering the mail as junk.

    Sample Code using System.Net.Mail:

    MailMessage message = new MailMessage();
    message.From = new MailAddress('[email protected]');
    message.To.Add(new MailAddress('[email protected]'));
    message.Bcc.Add(new MailAddress('[email protected]'));
    message.Subject = 'DASP is the best';
    message.Body = 'DASP provides the best service';
    SmtpClient smtp = new SmtpClient();
    smtp.Host = 'localhost';
    smtp.Send(message);

    I tested this on a gmail account and it works fine.

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page