Send mail with different reply-to address – part 2

Like the in cu 400 used mailing .net assembly the one used in cu 397 has very basic functionality, assembly Microsoft.Dynamics.Nav.Integration.Office. So if you want to use additional properties like setting a different reply-to address or using as different sender address, it is needed write it’s own code using basic .net assemblies. In  part 1 of this series i showed how to send smtp mails with the opportunity to set a different reply-to address. In this part i who, how to get the same with oulook based functionalities.

// variablesolApp, 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'SendOLMail()IF NOT ISNULL(olApp) THEN  CLEAR(olApp);olApp := olApp.ApplicationClass;olMailItem := olApp.CreateItem(olItemType.olMailItem);olMailItem."To" := 'receiver@test.com';olMailItem.Subject := 'subject text';olMailItem.Body := 'This is the message.';// set reply-to addressolMailItem.ReplyRecipients.Add('replyAddress@test.com');olMailItem.Send;CLEAR(olMailItem);CLEAR(olApp);

for using a different sender address in outlook mails follow this post.

cheers