login about faq

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...

Thanks, Avis

asked Mar 07 '13 at 16:05

Avis's gravatar image


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.)


answered Mar 08 '13 at 09:20

chilkat's gravatar image

chilkat ♦♦

Thanks for the answer. I was building a string of comma-separated email addresses, and adding it back in using "AddMultipleTo". It's good to have more options.

(Mar 08 '13 at 10:36) Avis
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Mar 07 '13 at 16:05

Seen: 1,739 times

Last updated: Mar 08 '13 at 10:36

powered by OSQA