Search code examples
c#outlookoutlook-addin

Outlook addinn Mailitem.forward more then one recipient returns exception


I'm trying to forward a mail. It works ok when there is only 1 recipient. But if I add more then one recipients, I got an exception that "One or more names are not recognized". I checked smtp addresses , everything is Ok. Then I send a new mail (not a forwarding), these addresses work without any exceptions.

var newItem = mailItem.Forward();    
newItem.Recipients.Add("[email protected];[email protected]");  
newItem.Send(); 

I tryed to use ";" or "," as a separator. There is no difference.


Solution

  • You need to call newItem.Recipients.Add for each recipient:

    newItem.Recipients.Add("[email protected]"); 
    newItem.Recipients.Add("[email protected]");