*============================================== FUNCTION SendExcelFileByMail *============================================== LOCAL lcProfile, lcPassword, lcExcelFile, lcSubject, lcBody, lcIini_file, lnRecipients, lcbuffer LOCAL loApp, loNameSpace, loMailItem lcProfile = "" lcPassword = "" lcSubject = "TEST to send Excel File" lcExcelFile = getini("MEM_VAR", "MEM_EXCELFILE", gcIni) lcbody= " this is a test to send Excel File" loApp = CREATEOBJECT("Outlook.Application") loNameSpace = loApp.GetNameSpace("MAPI") loNameSpace.Logon(lcProfile , lcPassword) loMailItem = loApp.CreateItem(0) lcRecipient =getini("MEM_VAR", "MEM_RECIPIENT", gcIni) lnRecipients=OCCURS(",", lcRecipient) IF lnRecipients > 0 FOR i=1 TO lnRecipients+1 DO CASE CASE i=1 lcbuffer=SUBSTR(lcRecipient,1,AT(",",lcRecipient,i)-1) loMailItem.Recipients.ADD(lcbuffer) CASE i=lnRecipients+1 lcbuffer=ALLTR(SUBSTR(lcRecipient, AT(",",lcRecipient,i-1)+1)) loMailItem.Recipients.ADD(lcbuffer) OTHERWISE lcbuffer=ALLTR(SUBSTR(lcRecipient, AT(",",lcRecipient,i-1)+1 , ; AT(",",lcRecipient,i)-AT(",",lcRecipient,i-1) -1)) loMailItem.Recipients.ADD(lcbuffer) ENDCASE ENDFOR ELSE loMailItem.Recipients.ADD(lcRecipient) ENDIF loMailItem.Subject = lcSubject loMailItem.Body = lcBody loMailItem.Attachments.ADD(lcExcelFile, 1, 1, "gamm_active_and_stop") loMailItem.SEND loNameSpace.Logoff RETURN