MAPISession.DownLoadMail := FALSE; IF MAPISession.SessionID = 0 THEN BEGIN IF NOT GUIALLOWED THEN BEGIN IF "E-Mail Profile Name" = '' THEN BEGIN recKTNNASApplication.RESET; recKTNNASApplication.SETCURRENTKEYCode,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');
Comments
The components used for mail in NAS seem to need an extended mapi that ships with outlook 2000.
Of course (?) this is if you're using windows 2000, on Windows NT 4 the extended mapi comes with standard installation