Hi
I have been playing around with the Email routines in NAV, specifically the Mail codeunit 397 and trying to send multiple attachments by Outlook.
However, what seems to be a simple modification is being anything but!
I have added a function which is based on the standard CreateAndSendMessage function, but accepts an Array of AttachFilenames. This then calls the standard AttachFile function in a loop. See below.
However when attaching the second file NAV or Outlook seem to get it's knickers in a twist and comes up with the following error.
Microsoft Outlook is not available.
Do you want to continue to edit the e-mail?
I haven't been able to resolve this so thought I'd see if anyone had any clues. We are using NAV 2016 and Outlook 2013.
I have this working via SMTP but also need to have it working via Outlook.
Thanks in advance.
Chris
I have been playing around with the Email routines in NAV, specifically the Mail codeunit 397 and trying to send multiple attachments by Outlook.
However, what seems to be a simple modification is being anything but!
I have added a function which is based on the standard CreateAndSendMessage function, but accepts an Array of AttachFilenames. This then calls the standard AttachFile function in a loop. See below.
LOCAL CreateAndSendMessageMultipleAttachments(ToAddresses : Text;CcAddresses : Text;BccAddresses : Text;Subject : Text;Body : Text;AttachFilenames : ARRAY [4] OF Text;ShowNewMailDialogOnSend : Boolean;RunModal : Boolean) : Boolean
// -001
Initialize;
CreateMessage(ToAddresses,CcAddresses,BccAddresses,Subject,Body,ShowNewMailDialogOnSend,RunModal);
FOR Loop := 1 TO 4 DO
IF AttachFilenames[Loop] <> '' THEN
AttachFile(AttachFilenames[Loop]);
EXIT(Send);
// +001
AttachFile(Filename : Text)
Initialize;
IF Filename <> '' THEN
OutlookMessageHelper.AttachmentFileNames.Add(Filename);
However when attaching the second file NAV or Outlook seem to get it's knickers in a twist and comes up with the following error.
Microsoft Outlook is not available.
Do you want to continue to edit the e-mail?
I haven't been able to resolve this so thought I'd see if anyone had any clues. We are using NAV 2016 and Outlook 2013.
I have this working via SMTP but also need to have it working via Outlook.
Thanks in advance.
Chris