Search code examples
c#emailoutlookforwarding

c# forward Email from Outlook inbox


I want to forward an existing Email from my Outlook inbox folder. On recent research I found some different solutions:

  • get the current mail item and copy it to a new message
  • move method to move in a different folder
  • forward method...

My goal is to find a simple way to forward an existing Email to another E-Mail adress.

My code enclosed does not have access to send!

private void buttonExplorer_Click(object sender, RibbonControlEventArgs e)
{
    Microsoft.Office.Interop.Outlook.Selection mySelection = Globals.ThisAddIn.Application.ActiveExplorer().Selection;
    Microsoft.Office.Interop.Outlook.MailItem mailItem = null;
    foreach (Object obj in mySelection)
    {
        if (obj is Microsoft.Office.Interop.Outlook.MailItem)
        {
            mailItem = (Microsoft.Office.Interop.Outlook.MailItem)obj;
            mailItem.Forward();
            mailItem.Recipients.Add("[email protected]");
            mailItem.Send();
        }
    }
}

Would be nice if there is a simple way to solve the forwarding event issue.


Solution

  • Forward() creates a new item, as stated here.

    So you'll need to use that new item from then on:

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