You can add a message to the Outlook pst file using the following code:
Dim importMSG As MailMessage = Aspose.Email.MailMessage.Load(sFullpath)
Using pst As Aspose.Email.Storage.Pst.PersonalStorage = Aspose.Email.Storage.Pst.PersonalStorage.FromFile(pathToPstFile & "outlook.pst")
Dim inbox As FolderInfo = pst.RootFolder.GetSubFolder("Inbox")
inbox.AddMessage(MapiMessage.FromMailMessage(importMSG))
End Using
Thanks for the reply Margarita. Unfortunately I don’t want to place the email in a PST, I want to put it in a subfolder of the user’s Inbox.
So imagine that the user has an Inbox sub-folder named “TEMPLATES” and my code needs to place the MSGs that are in a Windows File System folder into this Outlook folder. How can I do that?
Aspose.Email doesn’t use Microsoft Outlook or Office Automation. You can add messages to a pst file directly or use an email client like ImapClient in case Outlook is connected to the server.