0 votes
by (750 points)
edited by

I am sending mail message object as an attachment as below code but when I receive the forwarded email i cant see bcc?? why?? i can only see cc

// an e-mail we just received
MailMessage original = imap.GetMailMessage(sequenceNumber);

// create a new message
MailMessage forward = new MailMessage();

// initialize it
forward.To = "mary@example.org";
forward.From = "peter@example.org";
forward.Subject = "FW: " + original.Subject;
forward.BodyText = "Hello, I am forwarding this to you!";

// and add the original e-mail as an attachment
forward.Attachments.Add(new Attachment(original));

// we are now ready to send the message
Applies to: Rebex Secure Mail
by (58.9k points)
So if I understand your problem correctly - you get the original email, which contains some BCC recipients. Then you add it as an attachment to another email and send it to some test account. After you receive the mail, and open the attached emails no BCC field is present?

1 Answer

0 votes
by (58.9k points)

Hello,

actually I have tested your code, sent the message and after I received it from the server, the BCC headers in the attached eml actually stayed there...

Try my code:

        // get mail with BCC from the server
        MailMessage original = imap.GetMailMessage(sequenceNumber);

        // see whether it contains the BCC header
        if (original.Bcc.Count == 0)
            Console.WriteLine("No BCC found in original email.");
        else
            Console.WriteLine("BCC header = '{0}'", original.Bcc);

        // new message
        MailMessage forward = new MailMessage();

        // initialize it
        forward.To = "mary@example.org";
        forward.From = "peter@example.org";
        forward.Subject = "FW: " + original.Subject;
        forward.BodyText = "Hello, I am forwarding this to you!";

        // add the original e-mail as an attachment
        forward.Attachments.Add(new Attachment(original));

        // send message
        Smtp smtp = new Smtp();
        smtp.Connect("SMTP-server");
        smtp.Login("user", "password");

        smtp.LogWriter = new Rebex.FileLogWriter(@"C:\temp\log.txt", LogLevel.Verbose);
        smtp.Send(forward, "from@domain.com", "to@domain.com");
        smtp.Disconnect();

If you do not get the BCC header in the attached email, just look into the verbose log and see whether the BCC header was there when sending by Rebex Smtp.

...