I'm working with email, in C++
I need the ability to remove To, CC or Bcc recipients at will, similar to removing an attachment using "DropSingleAttachment" to remove an attachment from the email object. Is there such a method that I'm missing? I am currently iterating the list to save it, and then adding then all back in except for the one I need to remove...
Unfortunately, there is no simple method to do it.
A slight modification to what you might be doing is this: Iterate over the list to build a string of comma-separated email addresses, but omit the email address to be removed. Then call email.AddHeaderField("To", strCommaDelimitedEmailAddresses)
The AddHeaderField method will replace the header if it already exists. (The AddHeaderField2 method can be called to add a duplicate header that has the same name as one that already exist. In this case, you'd want the header field to be replaced.)