I got the sample from the site you recommended. I modified the script and it didn't run can you verify the script to see where I go wrong?
;****Multiple Email files script*****************************************************************
;Script written 12/03/03 by Stuart Pearson
;The aEmail_files array holds the strings that detail the list of files to attach to the email
;When the files are added the script checks that the length of the `aEmail_files[n]` string is
;under 255 characters. If adding the file increases the length above 255 a new email is created,
;this process continues until all the files specified are included.
;The script has been taken from a larger script where the various parameters i.e. Email addresses
;and the files to send are already known, for this reason I have included multiple input boxes
;to get this information.
;************************************************************************************************
proc main
string sEmailfile = "c:\sas\sastxout" ;Receives string input of file specificaton
string aEmail_files[100] ;string array for files to attach to each email
string sEmail_lne ;string for dialogbox error message
string sEmail_temp ;string to
integer iCounter = 1 ;integer used for various loops
integer iE_counter = 1 ;integer to log number of files to send
integer iEmail_Length ;integer to record length of email file string
integer iTemp_Length ;integer to check modified email string length
;is less than 255
string sMailLogon = "bnguyen" ;Mail logon/profile name
string sMailPassword = "Jen123" ;Not needed if using Exchange Server
string sTo = "bao.nguyen@logixcom.com" ;Recipients as they appear in the Outlook address book or enter just email address
string sCC = "" ;CC recipients
string sBCC = "" ;BCC recipients
string sSubject = "Email from Procomm" ;Subject of the message
string sContents = "test mail" ;text appearing in body of message
string sMailError ;Holds any returned errors
sdlginput "Enter Mail Logon/profile Name" "Logon/Profile Name:" sMailLogon DEFAULT
sdlginput "Enter Mail Password - not needed for Exchange Server" "Logon Password" sMailPassword DEFAULT
sdlginput "Enter Email Send Address" "To:" sTo DEFAULT
sdlginput "Enter Email CC Addresse(s) seperated by ;" "CC:" sCC DEFAULT
sdlginput "Enter Email BCC Addresse(s) seperated by ;" "BCC:" sBCC DEFAULT
sdlginput "Enter File Specification" "File Spec." sEmailfile DEFAULT
while iCounter !=100
aEmail_files[iCounter]=""
iCounter ++
endwhile
iE_counter=1
if findfirst sEmailfile
strlen aEmail_files[iE_counter] iTemp_Length
strlen $filespec iEmail_Length
if (iTemp_Length + iEmail_Length) < 255
strcat aEmail_files[iE_counter] $filespec
strcat aEmail_files[iE_counter] ";"
else
iE_counter ++
strcat aEmail_files[iE_counter] $filespec
strcat aEmail_files[iE_counter] ";"
endif
while findnext
sEmail_temp=aEmail_files[iE_counter]
strlen aEmail_files[iE_counter] iTemp_Length
strlen $filespec iEmail_Length
if (iTemp_Length + iEmail_Length) < 255
strcat aEmail_files[iE_counter] $filespec
strcat aEmail_files[iE_counter] ";"
else
iE_counter ++
strcat aEmail_files[iE_counter] $filespec
strcat aEmail_files[iE_counter] ";"
endif
if iE_counter==100
dialogbox 1 41 31 264 66 15 "WARNING"
text 1 32 26 200 12 "**NUMBER of EMAILs too high (>99)**" center
enddialog
pause 1
exitwhile
endif
endwhile
endif
iE_counter=1
if nullstr aEmail_files[1]
dialogbox 1 41 31 264 66 11 "INFORMATION"
text 1 72 26 120 12 "**NO EMAILS TO PROCESS**" center
enddialog
goto end_email
endif
while not stricmp aEmail_files[iE_counter] ""
mapisend sMailLogon sMailPassword sTo sCC sBCC sSubject sContents aEmail_files[iE_counter] sMailError
if SUCCESS
dialogbox 1 41 31 264 66 11 "INFORMATION"
text 1 72 26 120 12 "**EMAILS PROCESSED OK**" center
enddialog
else
strfmt sEmail_lne "**EMAIL ERROR DETECTED** (%s)" sMailError
dialogbox 1 41 31 264 66 11 "INFORMATION"
text 1 19 26 227 12 sEmail_lne center
enddialog
pause 1
endif
iE_counter ++
endwhile
end_email:
pause 1
dlgdestroy 1 cancel
endproc