Question

I am creating an outlook add in which needs to make modifications on the TO and CC fields before sending the message. I tried editing the TO property of the MailItem object but when I edit it, the mail doesn't get sent, it gets stuck in the Outbox. I also looked at the Recipients collection but it's read only so not of any use. Is there any mapping being maintained by Outlook between TO and Recipients collection which fails when I edit TO property?

What is the ideal way to make these changes and still have the mail be delivered properly?

Was it helpful?

Solution

Use yourMailItem.Recipients.Add("foo@bar.com") to add recipients.
To set them as CC set the recipient type to olCC (e.g. Recipients.Item(1).Type = olCC).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top