vbscript - VB Script - Undefined variable -


i'm getting 'variable undefined', i'm guessing has scope of variables in vbscript, knowledge limited this.

i know loading of email addresses works , actual emailing because have checked these separately. i'm trying loop through list of email addresses , send log file each..

any additional information great!

first, there var array @ top of file:

dim emails()  function getemailaddresses()      dim objfso     dim objconfigfile     dim strline     dim icounter      const forreading = 1, forwriting = 2, forappending = 8        set objfso = createobject("scripting.filesystemobject")     set objconfigfile = objfso.opentextfile("emailaddresses.config", forreading)      icounter = 0      while not objconfigfile.atendofstream         redim preserve emails(icounter)         strline = trim(objconfigfile.readline)         emails(icounter) = strline         icounter = icounter + 1     loop      objconfigfile.close  end function  function writetolog(strlogtext)      dim objfso     dim objlogfile      const forreading = 1, forwriting = 2, forappending = 8      set objfso = createobject("scripting.filesystemobject")     set objlogfile = objfso.opentextfile("xxx.log", forappending, true)      objlogfile.writeline now() & "  -  " & strlogtext        objlogfile.close       call emaillogfile(strlogtext)  end function   function emaillogfile(bodytext)      each emailaddress in emails          set objemail = createobject("cdo.message")         objemail.from = "file.mover@xxxxxxx.xxx"          objemail.to = emailaddress         objemail.subject = "file move log"          objemail.textbody = bodytext         objemail.configuration.fields.item _             ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2         objemail.configuration.fields.item _             ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _         "xxxxxx"          objemail.configuration.fields.item _             ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25         objemail.configuration.fields.update         objemail.send     next end function 

it doesn't you're calling getemailaddresses() anywhere file won't read , emails array won't populated


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -