I am using your CkoEmail object with Objective-C/Cocoa and think that is is amazing. One problem I am having though is with AddBcc (or add multiple BCC). When I use these functions, the BCC email addresses never get added and do not show up when I print out the mime content. Any idea? Below is the result of [[mimeEmail GetMimeObject] GetMime] (with encoding set to base64).
Yes, this is by design. The original thinking (many years ago) was that BCC addresses should be handled in a way such that it wouldn't be prone to accidentally sending email w/ the BCC recipients exposed to all other recipients. If BCC addresses were saved in the .eml it would be a MIME header, and it would also be included (just like any MIME header) in the email that is sent -- thus making the BCC addresses visible to all.
The BCC addresses are in the XML because when the email object is loaded from XML, the MIME must be reconstructed, and the BCC addresses are not included in the MIME (they are instead saved as internal data within the email object).
One solution for persisting BCC addresses in the MIME header is to write them to header field(s) that being with "ckx-". By default, when Chilkat sends email, it will automatically strip all header fields beginning with "ckx-". Therefore, you might use the email.AddHeaderField (or AddHeaderField2) method to write BCC addresses into the header, perhaps to a "ckx-bcc" header field. They'll get saved with the eml, restored when the .eml is re-loaded, and your application code can explicitly re-populate the BCC addresses from the ckx-bcc header(s).
When an email is sent with BCC recipients, the BCC email addresses are not listed in the header. The “To” recipients are listed in the “To” header field, and the “CC” recipients are listed in the “CC” header field, but the BCC recipients are intentionally left out. This is what makes it a “blind” carbon copy — the recipients are unable to see the BCC recipients. (It is by design.) Otherwise the BCC recipients would be equivalent to “CC” recipients. To understand how BCC recipients receive an email, I recommend reading this blog post: SMTP Protocol in a Nutshell. The BCC recipients are passed to the SMTP server in “RCPT TO” commands.
I think this is related enough to this question to follow up (feel free to ask me to create a new question). I was looking at BCC functions as well. I notice that if I create an email with a bcc and then save it as eml, the bcc gets stripped. If I save it as XML it's in there. Is this by design? I understand that BCC isn't transmitted on to the SMTP server, but while creating a draft that then gets read back in, I would assume you would want to save the bcc field.