NAS and MSMAPI

[:(] Hi, I do have a problem with nas & msmapi. When i run a codeunit in foreground from a navision client which has te send an email using msmapi the email is being succesful send. When i run this same codeunit in a nas with the same (Windows)user on the same machine the mail is not send. Here is my code : MAPISession.DownLoadMail := FALSE; IF MAPISession.SessionID = 0 THEN BEGIN IF NOT GUIALLOWED THEN BEGIN IF “E-Mail Profile Name” = ‘’ THEN BEGIN recKTNNASApplication.RESET; recKTNNASApplication.SETCURRENTKEY(Code,Application,Company); recKTNNASApplication.SETRANGE(Code,‘BACKGROUND’); recKTNNASApplication.SETRANGE(Application,‘KTN’); recKTNNASApplication.SETRANGE(Company,COMPANYNAME); IF recKTNNASApplication.FIND(’-’) THEN “E-Mail Profile Name” := recKTNNASApplication.“E-Mail profile name”; END; MAPISession.UserName := “E-Mail Profile Name”; MAPISession.LogonUI := FALSE; END; MAPISession.SignOn; END; MAPIMessages.SessionID := MAPISession.SessionID; MAPIMessages.Compose; fct_SetNames(1,ToName); MESSAGE(‘set names’); fct_SetNames(2,CCName); MESSAGE(‘set names2’); MAPIMessages.MsgSubject := Subject; MESSAGE(‘set subject’); NoOfAttachments := 0; WHILE AttachFileName[NoOfAttachments + 1] <> ‘’ DO NoOfAttachments := NoOfAttachments + 1; IF NoOfAttachments = 0 THEN BEGIN MAPIMessages.MsgNoteText := Body; MESSAGE(‘body’); END ELSE BEGIN MESSAGE(’%1’,NoOfAttachments); MESSAGE(’%1’,AttachFileName[1]); MAPIMessages.MsgNoteText := Body + PADSTR(’’,NoOfAttachments); // reserve positions for multiple attachments FOR i := 1 TO NoOfAttachments DO BEGIN MAPIMessages.AttachmentIndex := i - 1; MAPIMessages.AttachmentType := 0; MAPIMessages.AttachmentPathName := AttachFileName[i]; MAPIMessages.AttachmentPosition(STRLEN(Body) + i - 1); END; END; MESSAGE(‘before sending’); MAPIMessages.Action(3); // Send or //MAPIMessages.Send; MESSAGE(‘after sending’); When i go and look in the event log the last message is “before sending” and the nas is hanging and doing nothing … First i assumed it has something to do with profiles but i checked this. I also tryed this with the outlook app open and closed! Anyone ???

Did you try skip the MESSAGEs?

Yep, It took a couple of hours before we found out at which statement the error occured. we placed messages in the codeunits after we encountered the problem to see at what point the system stopped. Greetings