0 votes

When we have emails with recipients in only CC field while I send to any email and then downloading that email using mail.dll then in To field i get no values, but while I send the email with recipients only in BCC field then in that case while downloading that email I get "name=undisclosed-recipients" in To field.

Why is it so, because even though if my email Id is in BCC i should be able to see which all ids are there in To field?

by

1 Answer

0 votes

1.
BCC header is never present in the downloaded email.
Email recipients (TO's, CC's and BCC's) are not supposed to see any other BCC recipients.

The name BCC means Blind Carbon Copy, wheras CC is short for Carbon Copy.

2.
IMail has several address properties: IMail.To, IMail.Cc and IMail.Bcc.
CC recipients are available through in IMail.Cc collection.

using(Imap imap = new Imap())
{
   imap.Connect("imap.server.com");  // or ConnectSSL for SSL
   imap.UseBestLogin("user", "password");

   imap.SelectInbox();
   List<long> uids = imap.GetAll();
   foreach (long uid in uids)
   {
       IMail email = new MailBuilder()
           .CreateFromEml(imap.GetMessageByUID(uid));

       foreach (MailAddress address in mail.Cc)
       {
           foreach (MailBox mailbox in address.GetMailboxes())
           {
               Console.WriteLine("{0} <{1}>", mailbox.Name, mailbox.Address);
           }    
       }

   }
   imap.Close();
}

You can find more on accessing address fields here:
https://www.limilabs.com/blog/how-to-access-to-cc-bcc-fields

by (297k points)
...