O
Omatase
I want to add a MailItem directly to the Sent Items folder. I don't
want to actually 'send' the email. The purpose of adding the email to
the Sent Items folder is just to show that it was actually sent at
some point. The email was in fact already sent by another application
previously.
Here is the code I have tried to use, the problem I am having is that
the MailItem will only make it to the Drafts folder.
Microsoft.Office.Interop.Outlook.MAPIFolder outBoxfolder =
_MAPINamespace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderSentMail);
Microsoft.Office.Interop.Outlook.MailItem mailItem =
(Microsoft.Office.Interop.Outlook.MailItem)outBoxfolder.Items.Add(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Body = "test";
mailItem.To = "[email protected]";
mailItem.Subject = "subject";
mailItem.Save();
mailItem.Close(OlInspectorClose.olSave);
want to actually 'send' the email. The purpose of adding the email to
the Sent Items folder is just to show that it was actually sent at
some point. The email was in fact already sent by another application
previously.
Here is the code I have tried to use, the problem I am having is that
the MailItem will only make it to the Drafts folder.
Microsoft.Office.Interop.Outlook.MAPIFolder outBoxfolder =
_MAPINamespace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderSentMail);
Microsoft.Office.Interop.Outlook.MailItem mailItem =
(Microsoft.Office.Interop.Outlook.MailItem)outBoxfolder.Items.Add(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Body = "test";
mailItem.To = "[email protected]";
mailItem.Subject = "subject";
mailItem.Save();
mailItem.Close(OlInspectorClose.olSave);