Below code is for use to use the Clientside implementation of OUtlook New message. Nav Version is 2013. It's also sending message as HTML.
Declaration:
Name DataType Subtype Length
olApp DotNet Microsoft.Office.Interop.Outlook.ApplicationClass.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
olMailItem DotNet Microsoft.Office.Interop.Outlook.MailItem.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
olItemType DotNet Microsoft.Office.Interop.Outlook.OlItemType.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
olAccountList DotNet Microsoft.Office.Interop.Outlook.Accounts.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
olAccount DotNet Microsoft.Office.Interop.Outlook.Account.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
olAttachmentType DotNet Microsoft.Office.Interop.Outlook.OlAttachmentType.'Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
OutlookMessageHelper DotNet Microsoft.Dynamics.Nav.Integration.Office.Outlook.IOutlookMessage.'Microsoft.Dynamics.Nav.Integration.Office, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
CreatenewMessage Method
senderMailAddress := DefaultEmailSender;
olApp := olApp.ApplicationClass();
olItemType := olItemType.olMailItem;
olMailItem := olApp.CreateItem(olItemType);
//find the selected outlook profile and set it as sender mail address
olAccountList := olApp.Session.Accounts;
idx :=1;
REPEAT
olAccount := olAccountList.Item(idx);
IF LOWERCASE(olAccount.SmtpAddress) = LOWERCASE(senderMailAddress) THEN
olMailItem.SendUsingAccount := olAccount;
idx += 1;
UNTIL idx > olAccountList.Count;
olMailItem.Subject := Subject;
olMailItem."To" := TORecipients;
olMailItem.CC := CCRecipients;
olMailItem.BCC := BCCRecipients;
olMailItem.HTMLBody := '<HTML><BODY>' + BODY + '</BODY></HTML>'; //We want to send in HTML format
olMailItem.BodyFormat := 2;
IF BackOrdered THEN BEGIN
fileName := FileAttachment;
olMailItem.Attachments.Add(fileName,olAttachmentType.olByValue,1,fileName)
END;
olMailItem.Display(ShowDialog);
----above method will actually pop up the OUtlook Message...so user can choose to edit the message before sending. It also has file attachment.
Let me know if you have further questions.